GET /categories

Returns paginated JSON data about categories.

URL:
/categories

Method:
GET

URL Parameters:

  • none

Data Parameters:

  • page=[integer]
  • count=[integer] number of items returned per page, defaults to 10, max 100

Success Response:
Code: 200 OK
Content: 

{
    "data": [
        {
            "id": 937203467,
            "name": "Marketing",
            "slug": "marketing"
        },
        {
            "id": 1467473860,
            "name": "Development",
            "slug": "development"
        }
    ],
    "meta": {
        "pagination": {
            "total": 2,
            "count": 2,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 1,
            "links": []
        }
    }
}

Error Response: Code: 401 UNAUTHORIZED
Content: 

{ error : "You are unauthorized to make this request." }

GET /categories/{id}

Returns JSON data about a category.

URL:
/categories/{id}

Method:
GET

URL Parameters:

  • id=[integer] required

Data Parameters:

  • none

Success Response:
Code: 200 OK
Content: 

{
    "data": {
        "id": 937203467,
        "name": "Marketing",
        "slug": "marketing"
    }
}

Error Response: 

Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

Code: 404 NOT FOUND
Content: 

{ 
   "error":{  
      "message":"Not Found",
      "status":404
   }
}

POST /categories

Create a new category.

URL:
/categories

Method:
POST

URL Parameters:

  • none

Data Parameters:

  • none

Body (json): 

{  
   "name":"New Category"
}

Success Response:
Code: 200 OK
Content: 

{
    "data": {
        "id": 874992931,
        "name": "New Category",
        "slug": "new-category-5989a7878d225"
    }
}

Error Response: 

Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

Code: 400 BAD REQUEST
Content: 

{ 
   "error":{  
      "message":"The given data failed to pass validation.",
      "status":400
   }
}

PUT /categories/{id}

Updates an existing category.

URL:
/categories/{id}

Method:
PUT

URL Parameters:

  • id=[integer] required

Data Parameters:

  • none

Body (json): 

{  
   "name":"Updated Category"
}

Success Response:
Code: 200 OK
Content: 

{
    "data": {
        "id": 874992931,
        "name": "Updated Category",
        "slug": "new-category-5989a7878d225"
    }
}

Error Response: 

Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

Code: 400 BAD REQUEST
Content: 

{ 
   "error":{  
      "message":"The given data failed to pass validation.",
      "status":400
   }
}

Code: 404 NOT FOUND
Content: 

{ 
   "error":{  
      "message":"Not Found",
      "status":404
   }
}

DELETE /categories/{id}

Delete an existing category.

URL:
/categories/{id}

Method:
DELETE

URL Parameters:

  • id=[integer] required

Data Parameters:

  • none

Success Response:
Code: 200 OK

Error Response:
Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

Code: 404 NOT FOUND
Content: 

{ 
   "error":{  
      "message":"Not Found",
      "status":404
   }
}
Did this answer your question?