Create a rest endpoint for creating new unsubscriptions
Feature: Add unsubscription
Given the application running
And 0 unsubscription in the database
When the '/unsubscribtions' endpoint is requested with a 'POST' request with data like:
"""
{
"data": {
"type": "unsubscribtions",
"attributes": {
"email": "john.doe@example.org",
"created_at": 2017-06-26T14:05:10+0000
}
}
}
"""
Then it should send a 201 response with a JSON:
"""
{
"links": {
"self": "https://your-hostname.com/unsubscriptions/1"
}
"data": {
"type": "unsubscriptions",
"id": "1",
"attributes": {
"email": "john.doe@example.org",
"created_at": 2017-06-26T14:05:10+0000
}
}
}
"""
Feature: Add unsubscription
Given the application running
And 0 unsubscriptions in the database
When the '/unsubscriptions' endpoint is requested with a 'POST' request with data like:
"""
{
"data": {
"type": "unsubscriptions",
"attributes": {
"email": "john.doe@example.org",
}
}
}
"""
Then it should send a 201 response with a JSON:
"""
{
"links": {
"self": "https://your-hostname.com/unsubscriptions/1"
}
"data": {
"type": "unsubscriptions",
"id": "1",
"attributes": {
"email": "john.doe@example.org",
"created_at": 2017-06-26T14:05:10+0000
}
}
}
"""
Feature: Add unsubscription
Given the application running
And 0 unsubscriptions in the database
When the '/unsubscriptions' endpoint is requested with a 'POST' request with data like:
"""
{
"data": {
"type": "unsubscriptions",
"attributes": {
"created_at": 2017-06-26T14:05:10+0000
}
}
}
"""
Then it should send a 400 response with a JSON:
"""
{
"errors": [{
"status": "400",
"title": "Bad Request",
"detail": "The attribute field: \"email\" is missing"
}]
}
"""
Unsubscribe
Create a rest endpoint for creating new unsubscriptions
Feature: Add unsubscription Given the application running And 0 unsubscription in the database When the '/unsubscribtions' endpoint is requested with a 'POST' request with data like: """ { "data": { "type": "unsubscribtions", "attributes": { "email": "john.doe@example.org", "created_at": 2017-06-26T14:05:10+0000 } } } """ Then it should send a 201 response with a JSON: """ { "links": { "self": "https://your-hostname.com/unsubscriptions/1" } "data": { "type": "unsubscriptions", "id": "1", "attributes": { "email": "john.doe@example.org", "created_at": 2017-06-26T14:05:10+0000 } } } """
Feature: Add unsubscription Given the application running And 0 unsubscriptions in the database When the '/unsubscriptions' endpoint is requested with a 'POST' request with data like: """ { "data": { "type": "unsubscriptions", "attributes": { "email": "john.doe@example.org", } } } """ Then it should send a 201 response with a JSON: """ { "links": { "self": "https://your-hostname.com/unsubscriptions/1" } "data": { "type": "unsubscriptions", "id": "1", "attributes": { "email": "john.doe@example.org", "created_at": 2017-06-26T14:05:10+0000 } } } """
Feature: Add unsubscription Given the application running And 0 unsubscriptions in the database When the '/unsubscriptions' endpoint is requested with a 'POST' request with data like: """ { "data": { "type": "unsubscriptions", "attributes": { "created_at": 2017-06-26T14:05:10+0000 } } } """ Then it should send a 400 response with a JSON: """ { "errors": [{ "status": "400", "title": "Bad Request", "detail": "The attribute field: \"email\" is missing" }] } """