Skip to content

Instantly share code, notes, and snippets.

@ardanirohman
Last active March 21, 2017 04:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ardanirohman/4d604b6da0fb397855a1c37d477ae287 to your computer and use it in GitHub Desktop.
Save ardanirohman/4d604b6da0fb397855a1c37d477ae287 to your computer and use it in GitHub Desktop.
Sample Mockup API Apiary
FORMAT: 1A
HOST: https://api.ecommerce.com/
# Ecommerce API
API documentation for E-commerce
## Categories Collection [/categories{?page}{?limit}]
### List Categories [GET]
+ Parameters
+ page : 1 (number) - optional
+ limit : 20 (number) - optional
+ Response 200 (application/json)
{
"data":[
{
"id": 1,
"name": "BAGS",
"icon": "bags.png",
"created_at": "7843731823",
"updated_at": "7843731823"
},
{
"id": 2,
"name": "ACCESSORIES",
"icon": "accessories.png",
"created_at": "7843731823",
"updated_at": "7843731823"
},
{
"id": 3,
"name": "SHOES",
"icon": "shoes.png",
"created_at": "7843731823",
"updated_at": "7843731823"
},
{
"id": 4,
"name": "SMALL LEATHER GOODS",
"icon": "small-leather-goods.png",
"created_at": "7843731823",
"updated_at": "7843731823"
}
],
"meta": {
"total": 100,
"page": 1,
"limit":20
}
}
### Create a New Category [POST]
+ Request (application/json)
{
"name": "TIMEPIECE",
"icon": "timepiece.png"
}
+ Response 201 (application/json)
+ Headers
Location: /categories/15
+ Body
{
"name": "TIMEPIECE",
"icon": "timepiece.png",
"created_at": "7843731823",
"updated_at": "7843731823"
}
### Update Category [PUT /{id}]
+ Parameters
+ id (number) - ID of category must integer
+ Request (application/json)
{
"name": "TIMEPIECE",
"icon": "timepiece.png"
}
+ Response 204 (application/json)
### Detail Category [GET /{id}]
+ Parameters
+ id: 1 (number) - ID of category must integer
+ Response 200 (application/json)
{
"name": "TIMEPIECE",
"icon": "timepiece.png",
"created_at": "7843731823",
"updated_at": "7843731823"
}
### Delete Category [DELETE /{id}]
+ Parameters
+ id (number) - ID of category must integer
+ Response 204 (application/json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment