Skip to main content
PATCH
/
{storeId}
/
categories
/
{id}
Update a category.
curl --request PATCH \
  --url https://partner-api.aasaan.shop/api/v1/partner-integrations/stores/{storeId}/categories/{id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Shampoo",
  "slug": "shampoo",
  "description": "Hair categories",
  "hide": false,
  "displayOrder": 0,
  "parentCategoryId": "6124bc492f3660f743776404",
  "image": {
    "id": 0,
    "url": "https://images.aasaan.app/123412421",
    "type": "image/png"
  }
}
'
import requests

url = "https://partner-api.aasaan.shop/api/v1/partner-integrations/stores/{storeId}/categories/{id}"

payload = {
"name": "Shampoo",
"slug": "shampoo",
"description": "Hair categories",
"hide": False,
"displayOrder": 0,
"parentCategoryId": "6124bc492f3660f743776404",
"image": {
"id": 0,
"url": "https://images.aasaan.app/123412421",
"type": "image/png"
}
}
headers = {"Content-Type": "application/json"}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Shampoo',
slug: 'shampoo',
description: 'Hair categories',
hide: false,
displayOrder: 0,
parentCategoryId: '6124bc492f3660f743776404',
image: {id: 0, url: 'https://images.aasaan.app/123412421', type: 'image/png'}
})
};

fetch('https://partner-api.aasaan.shop/api/v1/partner-integrations/stores/{storeId}/categories/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://partner-api.aasaan.shop/api/v1/partner-integrations/stores/{storeId}/categories/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Shampoo',
'slug' => 'shampoo',
'description' => 'Hair categories',
'hide' => false,
'displayOrder' => 0,
'parentCategoryId' => '6124bc492f3660f743776404',
'image' => [
'id' => 0,
'url' => 'https://images.aasaan.app/123412421',
'type' => 'image/png'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://partner-api.aasaan.shop/api/v1/partner-integrations/stores/{storeId}/categories/{id}"

payload := strings.NewReader("{\n \"name\": \"Shampoo\",\n \"slug\": \"shampoo\",\n \"description\": \"Hair categories\",\n \"hide\": false,\n \"displayOrder\": 0,\n \"parentCategoryId\": \"6124bc492f3660f743776404\",\n \"image\": {\n \"id\": 0,\n \"url\": \"https://images.aasaan.app/123412421\",\n \"type\": \"image/png\"\n }\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://partner-api.aasaan.shop/api/v1/partner-integrations/stores/{storeId}/categories/{id}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Shampoo\",\n \"slug\": \"shampoo\",\n \"description\": \"Hair categories\",\n \"hide\": false,\n \"displayOrder\": 0,\n \"parentCategoryId\": \"6124bc492f3660f743776404\",\n \"image\": {\n \"id\": 0,\n \"url\": \"https://images.aasaan.app/123412421\",\n \"type\": \"image/png\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://partner-api.aasaan.shop/api/v1/partner-integrations/stores/{storeId}/categories/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Shampoo\",\n \"slug\": \"shampoo\",\n \"description\": \"Hair categories\",\n \"hide\": false,\n \"displayOrder\": 0,\n \"parentCategoryId\": \"6124bc492f3660f743776404\",\n \"image\": {\n \"id\": 0,\n \"url\": \"https://images.aasaan.app/123412421\",\n \"type\": \"image/png\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "id": "623d3455ec3c4b3548eb4a322",
  "name": "Shampoo",
  "slug": "shampoo",
  "description": "Hair categories",
  "hide": false,
  "displayOrder": 0,
  "parentCategoryId": "6124bc492f3660f743776404",
  "image": {
    "id": 0,
    "url": "https://images.aasaan.app/123412421",
    "type": "image/png"
  },
  "date_created": "2022-03-25T03:17:44.092Z",
  "date_modified": "2022-06-10T07:51:12.510Z"
}

Path Parameters

storeId
string
required

Store ID for this resource request

id
string
required

Category Id

Body

application/json
name
string
required

Name

Example:

"Shampoo"

slug
string

Slug

Example:

"shampoo"

description
string

Shampoos and conditioners

Example:

"Hair categories"

hide
string

Hide a category

Example:

false

displayOrder
string

Display order

Example:

0

parentCategoryId
string

Parent category id

Example:

"6124bc492f3660f743776404"

image
object

Category image

Response

Category updated.

id
string

Unique identifier for the resource that was used to create this category

Example:

"623d3455ec3c4b3548eb4a322"

name
string

Name

Example:

"Shampoo"

slug
string

Slug

Example:

"shampoo"

description
string

Shampoos and conditioners

Example:

"Hair categories"

hide
string

Hide a category

Example:

false

displayOrder
string

Display order

Example:

0

parentCategoryId
string

Parent category id

Example:

"6124bc492f3660f743776404"

image
object

Category image

date_created
string

Created date

Example:

"2022-03-25T03:17:44.092Z"

date_modified
string

Modified date

Example:

"2022-06-10T07:51:12.510Z"