API
Docs and API's for Weasy.io
Categories
Manage all the products categories from your website.Accepts GET POST PUT DELETE
All requests to the API must be authenticated with an API key on the HTTP Authorization header.
GET
Get all categories or filter categories from your store.Request example
~ curl -i -X GET \
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
https://api.weasy.io/v1/category
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
https://api.weasy.io/v1/category
Body response example [ HTTP CODE: 200 ]
Body attributes
A json payload containing the following attributes.| NAME | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| lang | string | optional | define the language to show data options: all the iso country codes (ISO 3166-2) obtained from the Languages endpoint |
PUT
Change a category from your categories database.Request example
~ curl -i -X POST \
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '{"title":"Category new title","parent_id":2,"status":1,"seo_title":"Category new seo title","seo_url":"Category new seo url","seo_description":"Category new seo description","seo_metatag":"Category new seo metatags","lang":"en"}'\
https://api.weasy.io/v1/category/1
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '{"title":"Category new title","parent_id":2,"status":1,"seo_title":"Category new seo title","seo_url":"Category new seo url","seo_description":"Category new seo description","seo_metatag":"Category new seo metatags","lang":"en"}'\
https://api.weasy.io/v1/category/1
Body response example [ HTTP CODE: 200 ]
Path parameters
| NAME | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| id | integer | required | category id |
Body attributes
A json payload containing the following attributes.| NAME | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| lang | string | required | define language of the category options: all the iso country codes (ISO 3166-2) obtained from the Languages endpoint |
| title | string | optional | define title of the category |
| parent_id | integer | optional | define parent ID of the category options: 0 for root, id for others |
| status | integer | optional | define the status of the contact. options: 1 for active, 0 for inactive |
| seo_title | string | optional | define seo title of the category |
| seo_url | string | optional | define seo url of the category |
| seo_description | string | optional | define seo description of the category |
| seo_metatag | string | optional | define seo metatags of the category |
POST
Add a category to your categories database.Request example
~ curl -i -X POST \
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '[{"parent_id":0,"status":1,"permissions":1,"index_seo":1,"order":1,"i18n":{"pt":{"title":"Menu 1","seo_title":"titulo menu 1","seo_url":"menu1","seo_description":"seo descricao 1","seo_metatag":"seo metatag 1"},"en":{"title":"Menu 1 en","seo_title":"titulo menu 1 en ","seo_url":"menu1_en","seo_description":"seo descricao 1 en","seo_metatag":"seo metatag 1 en"}},"children":[{"status":1,"i18n":{"pt":{"title":"sub Menu 1","seo_title":"sub titulo menu 1","seo_url":"submenu1","seo_description":"sub seo descricao 1","seo_metatag":"sub seo metatag 1"},"en":{"title":"sub Menu 1 en","seo_title":"sub titulo menu 1 en ","seo_url":"submenu1_en","seo_description":"sub seo descricao 1 en","seo_metatag":"sub seo metatag 1 en"}}},{"status":1,"i18n":{"pt":{"title":"sub Menu 2","seo_title":"sub titulo menu 2","seo_url":"submenu2","seo_description":"sub seo descricao 2","seo_metatag":"seo metatag 1"},"en":{"title":"sub Menu 2 en","seo_title":"sub titulo menu 2 en ","seo_url":"submenu2_en","seo_description":"subseo descricao 2 en","seo_metatag":"sub seo metatag 2 en"}}}]},{"parent_id":0,"status":1,"order":2,"i18n":{"pt":{"title":"Menu 2","seo_title":"titulo menu 2","seo_url":"menu1","seo_description":"seo descricao2","seo_metatag":"seo metatag 2"},"en":{"title":"Menu 2 en","seo_title":"titulo menu 2 en","seo_url":"menu1_en","seo_description":"seo descricao2 en","seo_metatag":"seo metatag 2 en"}}}]'\
https://api.weasy.io/v1/category
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '[{"parent_id":0,"status":1,"permissions":1,"index_seo":1,"order":1,"i18n":{"pt":{"title":"Menu 1","seo_title":"titulo menu 1","seo_url":"menu1","seo_description":"seo descricao 1","seo_metatag":"seo metatag 1"},"en":{"title":"Menu 1 en","seo_title":"titulo menu 1 en ","seo_url":"menu1_en","seo_description":"seo descricao 1 en","seo_metatag":"seo metatag 1 en"}},"children":[{"status":1,"i18n":{"pt":{"title":"sub Menu 1","seo_title":"sub titulo menu 1","seo_url":"submenu1","seo_description":"sub seo descricao 1","seo_metatag":"sub seo metatag 1"},"en":{"title":"sub Menu 1 en","seo_title":"sub titulo menu 1 en ","seo_url":"submenu1_en","seo_description":"sub seo descricao 1 en","seo_metatag":"sub seo metatag 1 en"}}},{"status":1,"i18n":{"pt":{"title":"sub Menu 2","seo_title":"sub titulo menu 2","seo_url":"submenu2","seo_description":"sub seo descricao 2","seo_metatag":"seo metatag 1"},"en":{"title":"sub Menu 2 en","seo_title":"sub titulo menu 2 en ","seo_url":"submenu2_en","seo_description":"subseo descricao 2 en","seo_metatag":"sub seo metatag 2 en"}}}]},{"parent_id":0,"status":1,"order":2,"i18n":{"pt":{"title":"Menu 2","seo_title":"titulo menu 2","seo_url":"menu1","seo_description":"seo descricao2","seo_metatag":"seo metatag 2"},"en":{"title":"Menu 2 en","seo_title":"titulo menu 2 en","seo_url":"menu1_en","seo_description":"seo descricao2 en","seo_metatag":"seo metatag 2 en"}}}]'\
https://api.weasy.io/v1/category
Body response example [ HTTP CODE: 200 ]
Body attributes
A json payload containing the following attributes.| NAME | TYPE | REQUIRED | DESCRIPTION | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| parent_id | integer | optional | define the parent id for the child. Only used if you want to add this child as a node to another child | ||||||||||||||||
| status | integer | required | define the status for the node options: 0 for inactive, 1 for active |
||||||||||||||||
| permissions | integer | required | define the permissions of the node. options: 1 for all users, 0 for registered users |
||||||||||||||||
| index_seo | integer | required | define if this node is enabled for index on search engines options: 1 for active, 0 for inactive |
||||||||||||||||
| order | integer | optional | define the order of the node | ||||||||||||||||
| i18n | array of objects | required |
An array containing an object.
The key if the language. Ex: array("pt"=>array("title"=>"",...) , "en"=>array("title"=>"",...)) The key can be obtained in the Languages endpoint.
|
||||||||||||||||
| children | array of objects | optional | define the childrens for the node. You can have any number of childrens The structure of the children is equal to the main payload and it's recursive. the children payload shouldn't have the parent_id property as this is done automaticaly "children" => array( array( "status"=>1, "i18n" => array( "pt" => array( "title" => "sub Menu 1", "seo_title" => "sub titulo menu 1", "seo_url" => "submenu1", "seo_description" => "sub seo descricao 1", "seo_metatag" => "sub seo metatag 1" ), "en" => array( "title" => "sub Menu 1 en", "seo_title" => "sub titulo menu 1 en ", "seo_url" => "submenu1_en", "seo_description" => "sub seo descricao 1 en", "seo_metatag" => "sub seo metatag 1 en" ) ), .... ) |
DELETE
Delete a category or collection of categories from your categories database.Request example
~ curl -i -X DELETE \
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '[1,2]'\
https://api.weasy.io/v1/category
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '[1,2]'\
https://api.weasy.io/v1/category
Body response example [ HTTP CODE: 200 ]
Body attributes
| Attribute description |
|---|
| A json payload containing an array of id or ids. |