Category
Authentication
HTTP Authentication, scheme: bearer
Category
Create category
Code samples
const data = JSON.stringify({
name: 'Shoes',
parentId: '17a54659-a06a-464f-a914-190cee7d4b1a',
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', 'https://fakestoreapi.ru/category');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('Authorization', 'Bearer {access-token}');
xhr.send(data);POST /category
Body parameter
Parameters
Responses
To perform this operation, you must be authenticated by means of one of the following methods: bearer
Get root categories
Code samples
GET /category
Parameters
l
query
number
false
Items limit on page ( from 1 to 50 )
p
query
number
false
Items page ( min 1 )
Example responses
200 Response
Responses
5XX
Unknown
Server error
None
4XX
Unknown
Check response message
None
This operation does not require authentication
Get subcategories
Code samples
GET /category/{id}/children
Parameters
id
path
string
true
Parent category id
all
query
boolean
false
Retrieve all subcategories at all levels, or just the current one.
Example responses
200 Response
Responses
Response Schema
Status Code 200
» _uuid
string
true
none
Category id
» name
string
true
none
Category name
» hasChildren
boolean
false
none
Is category has children
» hasProduct
boolean
false
none
Is category has product
This operation does not require authentication
Update category
Code samples
PATCH /category/{id}
Body parameter
Parameters
id
path
string
true
Category id
Responses
To perform this operation, you must be authenticated by means of one of the following methods: bearer
Remove category by id
Code samples
DELETE /category/{id}
Parameters
id
path
string
true
Category id
all
query
boolean
true
none
Responses
To perform this operation, you must be authenticated by means of one of the following methods: bearer
Last updated