This page explains how to create Category elements.
| Parameter | Value | Mandatory |
|---|---|---|
| title | A non-empty string | YES |
| father_id | ID of the parent category you want to associate | NO |
| description | A string | NO |
| Field | Value | Description |
|---|---|---|
| id | string | Object ID |
| title | string | Object title |
| description | string | The associated description |
| created_at | string | The create date that follows the format Y-m-d H:i:sY(year) m(month) d(day) H(hours) i(minutes) s(seconds) |
| father_id | int | Father category ID |
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -H "access-token: [your-access-token]" -X POST http://API_DOMAIN/rest/v2/category.json -d '
{
"title": "Category title"
}'
{
"id":"2",
"title":"Category title",
"description":null,
"created_at":"2013-02-06 17:11:03",
"father_id": null
}
Note The object created will be returned as a response
$merideApi = new Meride\Api('[your-auth-code]', 'http://API_DOMAIN/', 'v2');
$response = $merideApi->create('category', array (
'title' => 'Category title',
));