Skip to content

Commit 463249e

Browse files
committed
Added category API doc
1 parent c5a5ee9 commit 463249e

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

categories/README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
API to create and get Joomla categories
2+
3+
## Create / Update Category
4+
5+
```http
6+
POST /index.php?option=com_api&app=categories&resource=categories&format=raw
7+
```
8+
9+
#### Request Params
10+
11+
| Param Name | Required | Type | Comment |
12+
| ---------- | -------- | ------- | :---- |
13+
| id | NO | INT | Used to update an category. If empty, will create a new category. |
14+
| title | YES | STRING | |
15+
| alias | NO | STRING | URL alias. Will be generated based on title if kept empty |
16+
| description | NO | STRING | |
17+
| published | NO | INT | 1 = Published (Default) / 0 = Unpublished |
18+
| parent_id | NO | INT | Specify a parent category id if you wish to create a subcategory |
19+
| language | NO | STRING | Will use the site's default language if none provided. |
20+
| extension | YES | STRING | Since Joomla supports using the categories extension for 3rd party components, this field specifies the extension name. Use com_content for article categories. |
21+
| access | NO | INT | Access Level for Category |
22+
23+
24+
#### Response Params
25+
26+
| Param Name | Comment |
27+
| ---------- | :------ |
28+
| success | true if the category was created, false if there was a problem |
29+
| message | Error mesage in case success is false |
30+
| data.results | Array containing a single [Category Object](#category-object) in case of success. Empty array in case of failure. |
31+
32+
## Get Categories List
33+
```http
34+
GET /index.php?option=com_api&app=categories&resource=categories&format=raw
35+
```
36+
#### Request Params
37+
38+
| Param Name | Required | Comment |
39+
| ---------- | -------- | :------ |
40+
| limit | NO | Defaults to 20 |
41+
| limitstart | NO | Defaults to 0 |
42+
| filters | NO | Key value pairs of values to filter on |
43+
| search | NO | search key for searching category titles |
44+
| fields | NO | Defaults to id, title, created_time |
45+
46+
47+
#### Response Params
48+
49+
| Param Name | Comment |
50+
| ---------- | :------- |
51+
| success | true if the API call succeeds, false if there was a problem |
52+
| message | Error mesage in case success is false |
53+
| data.results | Array of [Category Objects](#category-object) in case of success. Empty array in case of failure. |
54+
55+
56+
## Get Single Category
57+
```http
58+
GET /index.php?option=com_api&app=categories&resource=categories&format=raw&id=:id
59+
```
60+
61+
#### Request Params
62+
63+
| Param Name | Required | Comment |
64+
| ---------- | -------- | :------ |
65+
| fields | NO | Defaults to id, title, created_time |
66+
67+
68+
#### Response Params
69+
70+
| Param Name | Comment |
71+
| ---------- | :------- |
72+
| success | true if the API call succeeds, false if there was a problem |
73+
| message | Error mesage in case success is false |
74+
| data.results | Array containing a single [Category Object](#category-object) in case of success. Empty array in case of failure. |
75+
76+
77+
## Category Object
78+
The actual contents of the category object will vary based on which fields are requested, however the below is the list of all possible fields.
79+
80+
```json
81+
{
82+
"id" : "",
83+
"title" : "",
84+
"alias" : "",
85+
"description" : "",
86+
"published" : "",
87+
"created_time" : "",
88+
"modified_time" : "",
89+
"access" : "",
90+
"language" : "",
91+
"created_user_id": {
92+
"id" : "",
93+
"name" : "",
94+
"avatar" : ""
95+
},
96+
"language" : ""
97+
}
98+
```

0 commit comments

Comments
 (0)