Returns a paginated list of categories sorted by id
in descending order.
List All Categories
Header
Authorization String |
Set value to Bearer SECRET_KEY |
hidden integer |
If included, only visible or hidden categories will be returned. One of: 0 or 1 . |
limit integer |
Specify how many records you want to retrieve per page. If not specified we use a default value of 50. |
curl -L 'https://api.vendloop.com/categories/' \ -H 'Authorization: Bearer SECRET_KEY'
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.vendloop.com/categories', CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Authorization: Bearer SECRET_KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
var myHeaders = new Headers(); myHeaders.append("Authorization", "Bearer SECRET_KEY"); var requestOptions = { method: 'GET', headers: myHeaders, redirect: 'follow' }; fetch("https://api.vendloop.com/categories", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
val client = OkHttpClient() val request = Request.Builder() .url("https://api.vendloop.com/categories") .addHeader("Authorization", "Bearer SECRET_KEY") .build() val response = client.newCall(request).execute()
Sample Response
{ "status":true, "message":"Category records found", "data":[ { "id":"2", "name":"Drinks", "code":"drinks", "hidden":"0", "image_url":"https://app.vendloop.com/uploads/thumbs/09f171e35d717dd50ccde15227cb2534.jpg", "sub_categories":[ { "id":"3", "name":"Soft Drinks", "code":"soft_drinks", "hidden":"0", "image_url":null }, { "id":"4", "name":"Spirits", "code":"spirits", "hidden":"0", "image_url":null } ] }, { "code":"ingredients", "hidden":"1", "id":"1", "image_url":null, "name":"Ingredients", "sub_categories":null } ], "metadata":{ "limit":50, "start":1, "total":2 } }
{ "status": false, "message": "Category records not found" }
Fetch a Single Category
Returns details of a category with the given ID.
Header
Authorization String |
Set value to Bearer SECRET_KEY |
id required integer |
Auto-generated unique ID |
code string |
Specify the code for this category. this is ignored if the id parameter is used |
hidden integer |
If included, only visible or hidden categories will be returned. One of: 0 or 1 . |
curl -L 'https://api.vendloop.com/categories/{id_or_code}' \ -H 'Authorization: Bearer SECRET_KEY'
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.vendloop.com/categories/{id_or_code}', CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Authorization: Bearer SECRET_KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
var myHeaders = new Headers(); myHeaders.append("Authorization", "Bearer SECRET_KEY"); var requestOptions = { method: 'GET', headers: myHeaders, redirect: 'follow' }; fetch("https://api.vendloop.com/categories/{id_or_code}", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
val client = OkHttpClient() val request = Request.Builder() .url("https://api.vendloop.com/categories/{id_or_code}") .addHeader("Authorization", "Bearer SECRET_KEY") .build() val response = client.newCall(request).execute()
Sample Response
{ "status":true, "message":"Category record found", "data":{ "id":"2", "name":"Drinks", "code":"drinks", "hidden":"0", "image_url":"https://app.vendloop.com/uploads/thumbs/09f171e35d717dd50ccde15227cb2534.jpg", "sub_categories":[ { "id":"3", "name":"Soft Drinks", "code":"soft_drinks", "hidden":"0", "image_url":null }, { "id":"4", "name":"Spirits", "code":"spirits", "hidden":"0", "image_url":null } ] } }
{ "status": false, "message": "Category record not found" }
Delete a Single Category
Delete category with the given ID.
Header
Authorization String |
Set value to Bearer SECRET_KEY |
id required integer |
The ID of the category to be deleted. |
curl -L 'http://api.vendloop.com/categories/delete' \ -H 'Authorization: Bearer SECRET_KEY' \ -F 'id="{id}"'
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.vendloop.com/categories/delete', CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('id' => '{id}'), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer SECRET_KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
var myHeaders = new Headers(); myHeaders.append("Authorization", "Bearer SECRET_KEY"); var formdata = new FormData(); formdata.append("id", "{id}"); var requestOptions = { method: 'POST', headers: myHeaders, body: formdata, redirect: 'follow' }; fetch("https://api.vendloop.com/categories/delete", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
val client = OkHttpClient() val mediaType = "text/plain".toMediaType() val body = MultipartBody.Builder().setType(MultipartBody.FORM) .addFormDataPart("id","{id}") .build() val request = Request.Builder() .url("https://api.vendloop.com/categories/delete") .post(body) .addHeader("Authorization", "Bearer SECRET_KEY") .build() val response = client.newCall(request).execute()
Sample Response
{ "status": true, "message": "Category record deleted" }
{ "status": false, "message": "Category record not found" }