Category API

Manage a store's catalog using product and catalog APIs

What's a category?

Category is the bucket to carry your products. For a product to exist, it needs to have a category. So make sure you create the category before adding the respective products.

Category Entity

{
  "id":"c0a80002-7448-1b70-8174-48461f070863"
  "title":"SALE"
  "description":"On sale"
  "categoryLevel":1
  "updatedAt":"2020-09-01T06:06:29.128202Z"
}

Creating a category

See our Create Category reference section to view all the relevant fields needed to add a category.

curl --request POST \
  --url https://ecom.api.zoko.io/v1/category \
  --header 'apikey: your-api-key-here' \
  --header 'content-type: application/json' \
  --data '{"title":"Category Title","description":"this is a description for the category","categoryLevel":1}'
import requests

url = "https://ecom.api.zoko.io/v1/category"

payload = {
    "title": "Category Title",
    "description": "this is a description for the category",
    "categoryLevel": 1
}
headers = {
    "apikey": "your-api-key-here",
    "content-type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
const request = require('request');

const options = {
  method: 'POST',
  url: 'https://ecom.api.zoko.io/v1/category',
  headers: {apikey: 'your-api-key-here', 'content-type': 'application/json'},
  body: {
    title: 'Category Title',
    description: 'this is a description for the category',
    categoryLevel: 1
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://ecom.api.zoko.io/v1/category")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["apikey"] = 'your-api-key-here'
request["content-type"] = 'application/json'
request.body = "{\"title\":\"Category Title\",\"description\":\"this is a description for the category\",\"categoryLevel\":1}"

response = http.request(request)
puts response.read_body

Response:

  {
    'id': '75df5ab8-f1fa-11ea-9b75-42010a67e00f',
    'title': 'Category Title', 
    'description': 'this is a description for the category',
    'categoryLevel': 1, 
    'updatedAt': '2020-09-08T17:41:00.532735Z'
}

Remember the id of the newly created category, so you can add product(s) to that one



Next Step: Now let's create product Product API


Did this page help you?