Skip to main content
PUT
/
brands
Put a multiple brands
curl --request PUT \
  --url https://api.aasaan.shop/api/v1/stores/brands \
  --header 'Content-Type: application/json' \
  --data '
[
  {
    "id": "ae7219",
    "name": "Head & Shoulders",
    "slug": "head_shoulders",
    "description": "Head & Shoulders",
    "hide": false,
    "displayOrder": 0,
    "active": "true",
    "image": {
      "id": 0,
      "url": "https://images.aasaan.app/123412421",
      "type": "image/png"
    }
  }
]
'
import requests

url = "https://api.aasaan.shop/api/v1/stores/brands"

payload = [
{
"id": "ae7219",
"name": "Head & Shoulders",
"slug": "head_shoulders",
"description": "Head & Shoulders",
"hide": False,
"displayOrder": 0,
"active": "true",
"image": {
"id": 0,
"url": "https://images.aasaan.app/123412421",
"type": "image/png"
}
}
]
headers = {"Content-Type": "application/json"}

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

print(response.text)
const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify([
{
id: 'ae7219',
name: 'Head & Shoulders',
slug: 'head_shoulders',
description: 'Head & Shoulders',
hide: false,
displayOrder: 0,
active: 'true',
image: {id: 0, url: 'https://images.aasaan.app/123412421', type: 'image/png'}
}
])
};

fetch('https://api.aasaan.shop/api/v1/stores/brands', 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://api.aasaan.shop/api/v1/stores/brands",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
[
'id' => 'ae7219',
'name' => 'Head & Shoulders',
'slug' => 'head_shoulders',
'description' => 'Head & Shoulders',
'hide' => false,
'displayOrder' => 0,
'active' => 'true',
'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://api.aasaan.shop/api/v1/stores/brands"

payload := strings.NewReader("[\n {\n \"id\": \"ae7219\",\n \"name\": \"Head & Shoulders\",\n \"slug\": \"head_shoulders\",\n \"description\": \"Head & Shoulders\",\n \"hide\": false,\n \"displayOrder\": 0,\n \"active\": \"true\",\n \"image\": {\n \"id\": 0,\n \"url\": \"https://images.aasaan.app/123412421\",\n \"type\": \"image/png\"\n }\n }\n]")

req, _ := http.NewRequest("PUT", 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.put("https://api.aasaan.shop/api/v1/stores/brands")
.header("Content-Type", "application/json")
.body("[\n {\n \"id\": \"ae7219\",\n \"name\": \"Head & Shoulders\",\n \"slug\": \"head_shoulders\",\n \"description\": \"Head & Shoulders\",\n \"hide\": false,\n \"displayOrder\": 0,\n \"active\": \"true\",\n \"image\": {\n \"id\": 0,\n \"url\": \"https://images.aasaan.app/123412421\",\n \"type\": \"image/png\"\n }\n }\n]")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.aasaan.shop/api/v1/stores/brands")

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

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"id\": \"ae7219\",\n \"name\": \"Head & Shoulders\",\n \"slug\": \"head_shoulders\",\n \"description\": \"Head & Shoulders\",\n \"hide\": false,\n \"displayOrder\": 0,\n \"active\": \"true\",\n \"image\": {\n \"id\": 0,\n \"url\": \"https://images.aasaan.app/123412421\",\n \"type\": \"image/png\"\n }\n }\n]"

response = http.request(request)
puts response.read_body
{
  "brands": [
    {
      "id": "623d3455ec3c4b3548eb4a322",
      "name": "Head & Shoulders",
      "slug": "head_shoulders",
      "description": "Head & Shoulders",
      "hide": false,
      "displayOrder": 0,
      "active": "true",
      "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"
    }
  ],
  "errors": [
    "Brand with BrandId - brand-id-1 is missing name"
  ]
}

Body

application/json
id
string
required

id

Example:

"ae7219"

name
string
required

Name

Example:

"Head & Shoulders"

slug
string

Slug

Example:

"head_shoulders"

description
string

Head & Shoulders brand

Example:

"Head & Shoulders"

hide
boolean

Hide a brand

Example:

false

displayOrder
string

Display order

Example:

0

active
boolean

Activate the brand

Example:

"true"

image
object

Brand image

Response

Brands created or update in an array and an array with errors for those brands which couldn't be updated.

brands
object[]
errors
string[]