API Doc List

List API list


//continuing from above explanations
$client->request('GET','list',[
'headers'=>$headers
]);

Result (Commentary is explanatory only)


//result
//please check status code before processing result,
//unless it return 200, it was not necessary to parse anything
//if status code is 200, please check status value in result content
//it it success, there will be returned data, else no data
//this is applied to all api
{
"code": 200,
"status": "success",
"data":[
{
"id": "1",
"name": "Example",
"slug": "example"
},
{
"id": "2",
"name": "Example 1",
"slug": "Example-1"
},
{
"id": "3",
"name": "Example 2",
"slug": "example-2"
},
{
"id": "4",
"name": "Example 3",
"slug": "example-3"
}
],
//currently shown
"count": 4,
//total, by default, we only show 100 per request
"total": 4,
//change offset by adding to header, $headers['Offset'] = 101
"offset" : 0,
"message": "Get All List"
}


//continuing from above explanations
$client->request('GET','list/1',[
'headers'=>$headers
]);

Result (Commentary is explanatory only)


//result
//please check status code before processing result,
//unless it return 200, it was not necessary to parse anything
//if status code is 200, please check status value in result content
//it it success, there will be returned data, else no data
//this is applied to all api
{
"code": 200,
"status": "success",
"data":
{
"id": "1",
"name": "Example",
"slug": "example"
}
"count": 1,
"message": "Get List by ID 1"
}


//continuing from above explanations
$client->request('POST','list',[
'headers'=>$headers,
'form_params'=>[
//the only parameter you need, slug is generated by default
'name'=>'Example'
]
]);

Result (Commentary is explanatory only)


//result
//please check status code before processing result,
//unless it return 200, it was not necessary to parse anything
//if status code is 200, please check status value in result content
//it it success, there will be returned data, else no data
//this is applied to all api
{
"code": 200,
"status": "success",
"data":
{
"id": "1",
"name": "Example",
"slug": "example"
}
"count": 1,
"message": "List has been created"
}

UPDATE LIST, METHOD : PUT


//continuing from above explanations
$client->request('PUT','list/1',[
'headers'=>$headers,
'form_params'=>[
//the only parameter you need, slug is generated by default
'name'=>'Update Example'
]
]);

Result (Commentary is explanatory only)


//result
//please check status code before processing result,
//unless it return 200, it was not necessary to parse anything
//if status code is 200, please check status value in result content
//it it success, there will be returned data, else no data
//this is applied to all api
{
"code": 200,
"status": "success",
"data":
{
"id": "1",
"name": "Update Example",
"slug": "example"
}
"count": 1,
"message": "List has been updated"
}

DELETE LIST, METHOD : DELETE


//continuing from above explanations
$client->request('DELETE','list/1',[
'headers'=>$headers
]);

Result (Commentary is explanatory only)


//result
//please check status code before processing result,
//unless it return 200, it was not necessary to parse anything
//if status code is 200, please check status value in result content
//it it success, there will be returned data, else no data
//this is applied to all api
{
"code": 200,
"status": "success",
"data":
{
"id": "1",
"name": "Update Example",
"slug": "example"
}
"count": 1,
"message": "Delete list id 1"
}

ERROR EXAMPLE


//Possible error
//The code value, in response body is the same with status code in result header
{
"code": 400,
"status": "error",
"message": "Malformed request"
},
{
"code": 403,
"status": "error",
"message": "Forbidden access"
},
{
"code": 500,
"status": "error",
"message": "Something unexpected happen"
},
{
"code": 200,
"status": "error",
"data":[],
"count": 1,
"message": "Delete List id 2"
}
//