API REST created to returned Category CRUD.
Returns json data about a multi categories.
-
URL
/categories
-
Method:
GET
-
URL Params
Required:
None
-
Data Params
None
-
Success Response:
- Code: 200
Content:[{ id : 12, name : "Limpeza", description : "Produtos de Limpeza" }]
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ error : "Categories doesn't exist" }
- Code: 404 NOT FOUND
-
Sample Call:
$.ajax({ url: "/categories", dataType: "json", type : "GET", success : function(r) { console.log(r); } });
Returns json data about a single category.
-
URL
/categories/:id
-
Method:
GET
-
URL Params
Required:
id=[integer]
-
Data Params
None
-
Success Response:
- Code: 200
Content:{ id : 12, name : "Limpeza", description : "Produtos de Limpeza" }
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ error : "Category doesn't exist" }
- Code: 404 NOT FOUND
-
Sample Call:
$.ajax({ url: "/categories/12", dataType: "json", type : "GET", success : function(r) { console.log(r); } });
Returns json data about a single category.
-
URL
/categories
-
Method:
POST
-
URL Params
Required:
name=[string]
-
Data Params
name=[string]
description=[string]
-
Success Response:
- Code: 200
Content:{ id : 12, name : "Limpeza", description : "Produtos de Limpeza" }
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ error : "Category doesn't exist" }
- Code: 404 NOT FOUND
-
Sample Call:
$.ajax({ url: "/categories", dataType: "json", type : "POST", success : function(r) { console.log(r); } });
Returns json data about a single category.
-
URL
/categories/:id
-
Method:
POST
-
URL Params
Required:
id=[integer]
name=[string]
-
Data Params
name=[string]
description=[string]
-
Success Response:
- Code: 200
Content:{ id : 12, name : "Limpeza", description : "Produtos de Limpeza" }
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ error : "Category doesn't exist" }
- Code: 404 NOT FOUND
-
Sample Call:
$.ajax({ url: "/categories/12", dataType: "json", type : "PUT", success : function(r) { console.log(r); } });
Returns nothing data.
-
URL
/categories/:id
-
Method:
DELETE
-
URL Params
Required:
id=[integer]
-
Data Params
None
-
Success Response:
- Code: 200
Content: None
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ error : "Category doesn't exist" }
- Code: 404 NOT FOUND
-
Sample Call:
$.ajax({ url: "/categories/12", dataType: "json", type : "DELETE", success : function(r) { console.log(r); } });