Fullscreen
Loading...
 
Skip to main content

Api Categories Doc

Get all categories

Request URL - categories
Copy to clipboard
https://example.com/api/categories


cURL - categories
Copy to clipboard
curl -X 'GET' \ 'https://example.com/api/categories?parentId=1&descends=1&type=all' \ -H 'accept: application/json' \ -H 'Authorization: Bearer xxxxx'


PHP - categories
Copy to clipboard
<?php $url = 'https://example.com/api/categories?' . http_build_query([ 'parentId' => 1, 'descends' => 1, 'type' => 'all' ]); $headers = [ 'Accept: application/json', 'Authorization: Bearer xxxxx' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { $error_msg = curl_error($ch); echo 'Error: ' . $error_msg; } else { $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } } curl_close($ch); ?>


Javascript - categories
Copy to clipboard
const params = new URLSearchParams({ parentId: '1', descends: '1', type: 'all' }); fetch('https://example.com/api/categories?' + params.toString(), { method: 'GET', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer xxxxx' } }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - categories
Copy to clipboard
{ "1": { "categId": 1, "name": "Super Admin", "description": "", "parentId": 0, "rootId": 0, "hits": 0, "tplGroupContainerId": 0, "tplGroupPattern": null, "num_roles": 0, "objects": 0, "children": [ 2, 3 ], "descendants": [ 2, 3, 4, 5, 6, 7 ], "tepath": { "1": "Super Admin" }, "categpath": "Super Admin", "relativePathString": "Super Admin" }, "2": { "categId": 2, "name": "Contributers", "description": "", "parentId": 1, "rootId": 1, "hits": 0, "tplGroupContainerId": 0, "tplGroupPattern": null, "num_roles": 0, "objects": 0, "children": [ 6, 7 ], "descendants": [ 6, 7 ], "tepath": { "1": "Super Admin", "2": "Contributers" }, "categpath": "Super Admin::Contributers", "relativePathString": "Super Admin::Contributers" }, "3": { "categId": 3, "name": "Translators", "description": "", "parentId": 1, "rootId": 1, "hits": 0, "tplGroupContainerId": 0, "tplGroupPattern": null, "num_roles": 0, "objects": 0, "children": [ 4, 5 ], "descendants": [ 4, 5 ], "tepath": { "1": "Super Admin", "3": "Translators" }, "categpath": "Super Admin::Translators", "relativePathString": "Super Admin::Translators" }, "4": { "categId": 4, "name": "French Translators", "description": "", "parentId": 3, "rootId": 1, "hits": 0, "tplGroupContainerId": 0, "tplGroupPattern": null, "num_roles": 0, "objects": 0, "children": [], "descendants": [], "tepath": { "1": "Super Admin", "3": "Translators", "4": "French Translators" }, "categpath": "Super Admin::Translators::French Translators", "relativePathString": "Super Admin::Translators::French Translators" }, "5": { "categId": 5, "name": "Chinese Translators", "description": "", "parentId": 3, "rootId": 1, "hits": 0, "tplGroupContainerId": 0, "tplGroupPattern": null, "num_roles": 0, "objects": 0, "children": [], "descendants": [], "tepath": { "1": "Super Admin", "3": "Translators", "5": "Chinese Translators" }, "categpath": "Super Admin::Translators::Chinese Translators", "relativePathString": "Super Admin::Translators::Chinese Translators" }, "6": { "categId": 6, "name": "Developers", "description": "", "parentId": 2, "rootId": 1, "hits": 0, "tplGroupContainerId": 0, "tplGroupPattern": null, "num_roles": 0, "objects": 0, "children": [], "descendants": [], "tepath": { "1": "Super Admin", "2": "Contributers", "6": "Developers" }, "categpath": "Super Admin::Contributers::Developers", "relativePathString": "Super Admin::Contributers::Developers" }, "7": { "categId": 7, "name": "DevOps", "description": "", "parentId": 2, "rootId": 1, "hits": 0, "tplGroupContainerId": 0, "tplGroupPattern": null, "num_roles": 0, "objects": 0, "children": [], "descendants": [], "tepath": { "1": "Super Admin", "2": "Contributers", "7": "DevOps" }, "categpath": "Super Admin::Contributers::DevOps", "relativePathString": "Super Admin::Contributers::DevOps" } }



Parameters

  • parentId integer Optional: The ID of the parent category to return children or descendants of.

  • descends integer Optional: Return descendants of a category. Possible values are:
    • 0: Return children of a category
    • 1: Return descendants of a category

  • type string Optional: Possible values are
    • roots: return root level categories
    • all: return all categories
    • everything else return descendants of a category



Create a new category

Request URL - category
Copy to clipboard
https://example.com/api/categories


cURL - category
Copy to clipboard
curl -X 'POST' \ 'https://example.com/api/categories' \ -H 'accept: application/json' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Authorization: Bearer xxxxx' \ -d 'parentId=1&name=test%20category&description=description&parentPerms=true'


PHP - category
Copy to clipboard
<?php $url = 'https://example.com/api/categories'; $data = http_build_query([ 'parentId' => 1, 'name' => 'test category', 'description' => 'description', 'parentPerms' => true ]); $headers = [ 'Accept: application/json', 'Content-Type: application/x-www-form-urlencoded', 'Authorization: Bearer xxxxx' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response = curl_exec($ch); if (curl_errno($ch)) { $error_msg = curl_error($ch); echo 'Error: ' . $error_msg; } else { $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } } curl_close($ch); ?>


Javascript - category
Copy to clipboard
const formData = new URLSearchParams({ parentId: '1', name: 'test category', description: 'description', parentPerms: true }); fetch('https://example.com/api/categories', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Bearer xxxxx' }, body: formData.toString() }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - category
Copy to clipboard
{ "categId": 11, "name": "test category", "description": "description", "parentId": 1, "rootId": 1, "hits": 0, "tplGroupContainerId": 0, "tplGroupPattern": "", "num_roles": 0, "objects": 0, "children": [], "descendants": [], "tepath": { "1": "Super Admin", "11": "test category" }, "categpath": "Super Admin::test category", "relativePathString": "Super Admin::test category" }



Parameters

  • parentId integer Optional: The ID of the parent category

  • name string *: The name of the category

  • description string Optional: The description of the category

  • tplGroupContainerId integer Optional: The ID of the template group container

  • tplGroupPattern string Optional: The template group pattern
    • true: Copy parent category permissions
    • false: Do not copy parent category permissions


Update a category

Request URL - category
Copy to clipboard
https://example.com/api/categories/{categId}


cURL - category
Copy to clipboard
curl -X 'POST' \ 'https://example.com/api/categories/11' \ -H 'accept: application/json' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Authorization: Bearer xxxxx' \ -d 'parentId=1&name=test%20category%20updated&description=description%20updated&parentPerms=true'


PHP - category
Copy to clipboard
<?php $url = 'https://example.com/api/categories/11'; $data = http_build_query([ 'parentId' => 1, 'name' => 'test category updated', 'description' => 'description updated', 'parentPerms' => true ]); $headers = [ 'Accept: application/json', 'Content-Type: application/x-www-form-urlencoded', 'Authorization: Bearer xxxxx' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response = curl_exec($ch); if (curl_errno($ch)) { $error_msg = curl_error($ch); echo 'Error: ' . $error_msg; } else { $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } } curl_close($ch); ?>


Javascript - category
Copy to clipboard
const formData = new URLSearchParams({ parentId: '1', name: 'test category updated', description: 'description updated', parentPerms: true }); fetch('https://example.com/api/categories/11', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Bearer xxxxx' }, body: formData.toString() }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - category
Copy to clipboard
{ "categId": 11, "name": "test category updated", "description": "description updated", "parentId": 1, "rootId": 1, "hits": 0, "tplGroupContainerId": 0, "tplGroupPattern": "", "num_roles": 0, "objects": 0, "children": [], "descendants": [], "tepath": { "1": "Super Admin", "11": "test category updated" }, "categpath": "Super Admin::test category updated", "relativePathString": "Super Admin::test category updated" }



Parameters

  • parentId integer Optional: The ID of the parent category

  • name string *: The name of the category

  • description string Optional: The description of the category

  • tplGroupContainerId integer Optional: The ID of the template group container

  • tplGroupPattern string Optional: The template group pattern
    • true: Copy parent category permissions
    • false: Do not copy parent category permissions


Delete a category

Request URL - category
Copy to clipboard
https://example.com/api/categories/{categId}


cURL - category
Copy to clipboard
curl -X 'DELETE' \ 'https://example.com/api/categories/11' \ -H 'accept: application/json' \ -H 'Authorization: Bearer xxxxx'


PHP - category
Copy to clipboard
<?php $url = 'https://example.com/api/categories/11'; $headers = [ 'Accept: application/json', 'Authorization: Bearer xxxxx' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { $error_msg = curl_error($ch); echo 'Error: ' . $error_msg; } else { $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } } curl_close($ch); ?>


Javascript - category
Copy to clipboard
fetch('https://example.com/api/categories/11', { method: 'DELETE', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer xxxxx' } }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - category
Copy to clipboard
{ "categId": 11, "name": "test category updated", "description": "description updated", "parentId": 1, "rootId": 1, "hits": 0, "tplGroupContainerId": 0, "tplGroupPattern": "", "num_roles": 0, "objects": 0, "children": [], "descendants": [], "tepath": { "1": "Super Admin", "11": "test category updated" }, "categpath": "Super Admin::test category updated", "relativePathString": "Super Admin::test category updated" }



Parameters

  • categId string *: The category ID to be deleted


Categorize


Categorize one or more objects under a specific category

Request URL - categorize
Copy to clipboard
https://example.com/api/categorize


cURL - categorize
Copy to clipboard
curl -X 'POST' \ 'https://example.com/api/categorize' \ -H 'accept: application/json' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Authorization: Bearer xxxxx' \ -d 'categId=1&objects[]=wiki page:quiz' \ -d 'categId=1&objects[]=file gallery:1' \ -d 'categId=1&objects[]=trackeritem:1003'


PHP - categorize
Copy to clipboard
<?php $url = 'https://example.com/api/categorize'; $data = [ ['categId' => 1, 'objects[]' => 'wiki page:quiz'], ['categId' => 1, 'objects[]' => 'file gallery:1'], ['categId' => 1, 'objects[]' => 'trackeritem:1003'] ]; $postFields = []; foreach ($data as $pair) { foreach ($pair as $key => $value) { $postFields[] = urlencode($key) . '=' . urlencode($value); } } $body = implode('&', $postFields); $headers = [ 'Accept: application/json', 'Content-Type: application/x-www-form-urlencoded', 'Authorization: Bearer xxxxx' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $body); $response = curl_exec($ch); if (curl_errno($ch)) { $error_msg = curl_error($ch); echo 'Error: ' . $error_msg; } else { $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } } curl_close($ch); ?>


Javascript - categorize
Copy to clipboard
const formData = new URLSearchParams(); formData.append('categId', '1'); formData.append('objects[]', 'wiki page:quiz'); formData.append('categId', '1'); formData.append('objects[]', 'file gallery:1'); formData.append('categId', '1'); formData.append('objects[]', 'trackeritem:1003'); fetch('https://example.com/api/categorize', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Bearer xxxxx' }, body: formData.toString() }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - categorize
Copy to clipboard
{ "categId": 1, "count": 3, "objects": [ { "type": "wiki page", "id": "quiz", "catObjectId": 3 }, { "type": "file gallery", "id": "1", "catObjectId": 4 }, { "type": "trackeritem", "id": "1003", "catObjectId": 5 } ] }



Request body

  • categId integer *: The ID of the category to categorize the objects under

  • objects[] array *: Tiki object use format Type:ID where type is trackeritem, page, etc. and ID is the object identifier based on type.
    • eg. trackeritem:1, wiki page:homePage, file:3, blog:4, forum:5, file gallery:6, quiz:7, poll:8, calendar:9, tracker:10



Uncategorize


Uncategorize one or more objects from a specific category

Request URL - uncategorize
Copy to clipboard
https://example.com/api/uncategorize


cURL - uncategorize
Copy to clipboard
curl -X 'POST' \ 'https://example.com/api/uncategorize' \ -H 'accept: application/json' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Authorization: Bearer xxxxx' \ -d 'categId=1&objects[]=wiki page:quiz' \ -d 'categId=1&objects[]=file gallery:1' \ -d 'categId=1&objects[]=trackeritem:1003'


PHP - uncategorize
Copy to clipboard
<?php $url = 'https://example.com/api/uncategorize'; $data = [ ['categId' => 1, 'objects[]' => 'wiki page:quiz'], ['categId' => 1, 'objects[]' => 'file gallery:1'], ['categId' => 1, 'objects[]' => 'trackeritem:1003'] ]; $postFields = []; foreach ($data as $pair) { foreach ($pair as $key => $value) { $postFields[] = urlencode($key) . '=' . urlencode($value); } } $body = implode('&', $postFields); $headers = [ 'Accept: application/json', 'Content-Type: application/x-www-form-urlencoded', 'Authorization: Bearer xxxxx' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $body); $response = curl_exec($ch); if (curl_errno($ch)) { $error_msg = curl_error($ch); echo 'Error: ' . $error_msg; } else { $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } } curl_close($ch); ?>


Javascript - uncategorize
Copy to clipboard
const formData = new URLSearchParams(); formData.append('categId', '1'); formData.append('objects[]', 'wiki page:quiz'); formData.append('categId', '1'); formData.append('objects[]', 'file gallery:1'); formData.append('categId', '1'); formData.append('objects[]', 'trackeritem:1003'); fetch('https://example.com/api/uncategorize', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Bearer xxxxx' }, body: formData.toString() }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - uncategorize
Copy to clipboard
{ "categId": "1", "count": 0, "objects": [ { "type": "wiki page", "id": "quiz", "catObjectId": 3 }, { "type": "file gallery", "id": "1", "catObjectId": 4 }, { "type": "trackeritem", "id": "1003", "catObjectId": 5 } ] }



Request body

  • categId integer *: The ID of the category to categorize the objects under

  • objects[] array *: Tiki object use format Type:ID where type is trackeritem, page, etc. and ID is the object identifier based on type.
    • eg. trackeritem:1, wiki page:homePage, file:3, blog:4, forum:5, file gallery:6, quiz:7, poll:8, calendar:9, tracker:10

Show PHP error messages