Rails RESTful Backend API that exposes tea subscription endpoints.
POST /create
{
"customer_id": 6,
"tea_id": 20,
"title": "test subscription",
"price": "12.99",
"status": "active",
"frequency": "weekly"
}
Example Response:
{
"data": {
"id": 24,
"type": "Subscription",
"attributes": {
"title": "test subscription",
"price": "12.99",
"status": "active",
"frequency": "weekly",
"customer_id": 6,
"tea_id": 20
}
}
}
GET '/index'
{
"customer_id": 6
}
Example Response:
{
"data": {
"customer_id": 6,
"customer_email": "helena_bartoletti@damore.name",
"type": "Subscription Index",
"subscriptions": [
{
"id": 11,
"type": "Subscription",
"attributes": {
"status": "cancelled",
"frequency": "monthly"
}
},
{
"id": 12,
"type": "Subscription",
"attributes": {
"status": "cancelled",
"frequency": "monthly"
}
},
{
"id": 21,
"type": "Subscription",
"attributes": {
"status": "active",
"frequency": "weekly"
}
},
{
"id": 22,
"type": "Subscription",
"attributes": {
"status": "active",
"frequency": "weekly"
}
},
{
"id": 23,
"type": "Subscription",
"attributes": {
"status": "active",
"frequency": "weekly"
}
},
{
"id": 24,
"type": "Subscription",
"attributes": {
"status": "active",
"frequency": "weekly"
}
}
]
}
}
PATCH '/update'
{
"subscription_id": 24,
"status": "cancelled"
}
Returns Status 204 Updated Successfully