Update product variants Copy
curl --request PATCH \
--url http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc \
--header 'Content-Type: application/json' \
--data '
{
"attributes": [
{
"name": {
"_id": "63e10d4ed4df923a8dda34d0",
"name": "COLOR"
},
"options": [
{
"id": "63e10d4ed4df923a8dda34ce",
"label": "COLOR",
"name": "GOLD"
}
]
}
],
"variants": [
{
"_id": "63f76655c31eea543580fdda",
"alwaysInStock": true,
"costPrice": null,
"digital_download": {
"maxDownloadsPerOrder": 5,
"name": "sample.pdf",
"type": "application/pdf",
"url": "https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/",
"uuid": "92aaca76-e073-4a62-8244-5ea8c3c521b8"
},
"isActive": false,
"options": [
{
"id": "63e10d4ed4df923a8dda34ce",
"label": "COLOR",
"name": "GOLD"
}
],
"price": 17800,
"sale_price": 17300,
"sku": "digital-with-variant-2-gold-0fdd9",
"stock": 1
}
]
}
'import requests
url = "http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc"
payload = {
"attributes": [
{
"name": {
"_id": "63e10d4ed4df923a8dda34d0",
"name": "COLOR"
},
"options": [
{
"id": "63e10d4ed4df923a8dda34ce",
"label": "COLOR",
"name": "GOLD"
}
]
}
],
"variants": [
{
"_id": "63f76655c31eea543580fdda",
"alwaysInStock": True,
"costPrice": None,
"digital_download": {
"maxDownloadsPerOrder": 5,
"name": "sample.pdf",
"type": "application/pdf",
"url": "https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/",
"uuid": "92aaca76-e073-4a62-8244-5ea8c3c521b8"
},
"isActive": False,
"options": [
{
"id": "63e10d4ed4df923a8dda34ce",
"label": "COLOR",
"name": "GOLD"
}
],
"price": 17800,
"sale_price": 17300,
"sku": "digital-with-variant-2-gold-0fdd9",
"stock": 1
}
]
}
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({
attributes: [
{
name: {_id: '63e10d4ed4df923a8dda34d0', name: 'COLOR'},
options: [{id: '63e10d4ed4df923a8dda34ce', label: 'COLOR', name: 'GOLD'}]
}
],
variants: [
{
_id: '63f76655c31eea543580fdda',
alwaysInStock: true,
costPrice: null,
digital_download: {
maxDownloadsPerOrder: 5,
name: 'sample.pdf',
type: 'application/pdf',
url: 'https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/',
uuid: '92aaca76-e073-4a62-8244-5ea8c3c521b8'
},
isActive: false,
options: [{id: '63e10d4ed4df923a8dda34ce', label: 'COLOR', name: 'GOLD'}],
price: 17800,
sale_price: 17300,
sku: 'digital-with-variant-2-gold-0fdd9',
stock: 1
}
]
})
};
fetch('http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc', 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 => "http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc",
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([
'attributes' => [
[
'name' => [
'_id' => '63e10d4ed4df923a8dda34d0',
'name' => 'COLOR'
],
'options' => [
[
'id' => '63e10d4ed4df923a8dda34ce',
'label' => 'COLOR',
'name' => 'GOLD'
]
]
]
],
'variants' => [
[
'_id' => '63f76655c31eea543580fdda',
'alwaysInStock' => true,
'costPrice' => null,
'digital_download' => [
'maxDownloadsPerOrder' => 5,
'name' => 'sample.pdf',
'type' => 'application/pdf',
'url' => 'https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/',
'uuid' => '92aaca76-e073-4a62-8244-5ea8c3c521b8'
],
'isActive' => false,
'options' => [
[
'id' => '63e10d4ed4df923a8dda34ce',
'label' => 'COLOR',
'name' => 'GOLD'
]
],
'price' => 17800,
'sale_price' => 17300,
'sku' => 'digital-with-variant-2-gold-0fdd9',
'stock' => 1
]
]
]),
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 := "http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc"
payload := strings.NewReader("{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"63e10d4ed4df923a8dda34d0\",\n \"name\": \"COLOR\"\n },\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ]\n }\n ],\n \"variants\": [\n {\n \"_id\": \"63f76655c31eea543580fdda\",\n \"alwaysInStock\": true,\n \"costPrice\": null,\n \"digital_download\": {\n \"maxDownloadsPerOrder\": 5,\n \"name\": \"sample.pdf\",\n \"type\": \"application/pdf\",\n \"url\": \"https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/\",\n \"uuid\": \"92aaca76-e073-4a62-8244-5ea8c3c521b8\"\n },\n \"isActive\": false,\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ],\n \"price\": 17800,\n \"sale_price\": 17300,\n \"sku\": \"digital-with-variant-2-gold-0fdd9\",\n \"stock\": 1\n }\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("http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc")
.header("Content-Type", "application/json")
.body("{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"63e10d4ed4df923a8dda34d0\",\n \"name\": \"COLOR\"\n },\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ]\n }\n ],\n \"variants\": [\n {\n \"_id\": \"63f76655c31eea543580fdda\",\n \"alwaysInStock\": true,\n \"costPrice\": null,\n \"digital_download\": {\n \"maxDownloadsPerOrder\": 5,\n \"name\": \"sample.pdf\",\n \"type\": \"application/pdf\",\n \"url\": \"https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/\",\n \"uuid\": \"92aaca76-e073-4a62-8244-5ea8c3c521b8\"\n },\n \"isActive\": false,\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ],\n \"price\": 17800,\n \"sale_price\": 17300,\n \"sku\": \"digital-with-variant-2-gold-0fdd9\",\n \"stock\": 1\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"63e10d4ed4df923a8dda34d0\",\n \"name\": \"COLOR\"\n },\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ]\n }\n ],\n \"variants\": [\n {\n \"_id\": \"63f76655c31eea543580fdda\",\n \"alwaysInStock\": true,\n \"costPrice\": null,\n \"digital_download\": {\n \"maxDownloadsPerOrder\": 5,\n \"name\": \"sample.pdf\",\n \"type\": \"application/pdf\",\n \"url\": \"https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/\",\n \"uuid\": \"92aaca76-e073-4a62-8244-5ea8c3c521b8\"\n },\n \"isActive\": false,\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ],\n \"price\": 17800,\n \"sale_price\": 17300,\n \"sku\": \"digital-with-variant-2-gold-0fdd9\",\n \"stock\": 1\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyProducts
Update product variants copy
PATCH
/
{shopId}
/
products
/
63f76655c31eea543580fddc
Update product variants Copy
curl --request PATCH \
--url http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc \
--header 'Content-Type: application/json' \
--data '
{
"attributes": [
{
"name": {
"_id": "63e10d4ed4df923a8dda34d0",
"name": "COLOR"
},
"options": [
{
"id": "63e10d4ed4df923a8dda34ce",
"label": "COLOR",
"name": "GOLD"
}
]
}
],
"variants": [
{
"_id": "63f76655c31eea543580fdda",
"alwaysInStock": true,
"costPrice": null,
"digital_download": {
"maxDownloadsPerOrder": 5,
"name": "sample.pdf",
"type": "application/pdf",
"url": "https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/",
"uuid": "92aaca76-e073-4a62-8244-5ea8c3c521b8"
},
"isActive": false,
"options": [
{
"id": "63e10d4ed4df923a8dda34ce",
"label": "COLOR",
"name": "GOLD"
}
],
"price": 17800,
"sale_price": 17300,
"sku": "digital-with-variant-2-gold-0fdd9",
"stock": 1
}
]
}
'import requests
url = "http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc"
payload = {
"attributes": [
{
"name": {
"_id": "63e10d4ed4df923a8dda34d0",
"name": "COLOR"
},
"options": [
{
"id": "63e10d4ed4df923a8dda34ce",
"label": "COLOR",
"name": "GOLD"
}
]
}
],
"variants": [
{
"_id": "63f76655c31eea543580fdda",
"alwaysInStock": True,
"costPrice": None,
"digital_download": {
"maxDownloadsPerOrder": 5,
"name": "sample.pdf",
"type": "application/pdf",
"url": "https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/",
"uuid": "92aaca76-e073-4a62-8244-5ea8c3c521b8"
},
"isActive": False,
"options": [
{
"id": "63e10d4ed4df923a8dda34ce",
"label": "COLOR",
"name": "GOLD"
}
],
"price": 17800,
"sale_price": 17300,
"sku": "digital-with-variant-2-gold-0fdd9",
"stock": 1
}
]
}
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({
attributes: [
{
name: {_id: '63e10d4ed4df923a8dda34d0', name: 'COLOR'},
options: [{id: '63e10d4ed4df923a8dda34ce', label: 'COLOR', name: 'GOLD'}]
}
],
variants: [
{
_id: '63f76655c31eea543580fdda',
alwaysInStock: true,
costPrice: null,
digital_download: {
maxDownloadsPerOrder: 5,
name: 'sample.pdf',
type: 'application/pdf',
url: 'https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/',
uuid: '92aaca76-e073-4a62-8244-5ea8c3c521b8'
},
isActive: false,
options: [{id: '63e10d4ed4df923a8dda34ce', label: 'COLOR', name: 'GOLD'}],
price: 17800,
sale_price: 17300,
sku: 'digital-with-variant-2-gold-0fdd9',
stock: 1
}
]
})
};
fetch('http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc', 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 => "http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc",
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([
'attributes' => [
[
'name' => [
'_id' => '63e10d4ed4df923a8dda34d0',
'name' => 'COLOR'
],
'options' => [
[
'id' => '63e10d4ed4df923a8dda34ce',
'label' => 'COLOR',
'name' => 'GOLD'
]
]
]
],
'variants' => [
[
'_id' => '63f76655c31eea543580fdda',
'alwaysInStock' => true,
'costPrice' => null,
'digital_download' => [
'maxDownloadsPerOrder' => 5,
'name' => 'sample.pdf',
'type' => 'application/pdf',
'url' => 'https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/',
'uuid' => '92aaca76-e073-4a62-8244-5ea8c3c521b8'
],
'isActive' => false,
'options' => [
[
'id' => '63e10d4ed4df923a8dda34ce',
'label' => 'COLOR',
'name' => 'GOLD'
]
],
'price' => 17800,
'sale_price' => 17300,
'sku' => 'digital-with-variant-2-gold-0fdd9',
'stock' => 1
]
]
]),
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 := "http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc"
payload := strings.NewReader("{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"63e10d4ed4df923a8dda34d0\",\n \"name\": \"COLOR\"\n },\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ]\n }\n ],\n \"variants\": [\n {\n \"_id\": \"63f76655c31eea543580fdda\",\n \"alwaysInStock\": true,\n \"costPrice\": null,\n \"digital_download\": {\n \"maxDownloadsPerOrder\": 5,\n \"name\": \"sample.pdf\",\n \"type\": \"application/pdf\",\n \"url\": \"https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/\",\n \"uuid\": \"92aaca76-e073-4a62-8244-5ea8c3c521b8\"\n },\n \"isActive\": false,\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ],\n \"price\": 17800,\n \"sale_price\": 17300,\n \"sku\": \"digital-with-variant-2-gold-0fdd9\",\n \"stock\": 1\n }\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("http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc")
.header("Content-Type", "application/json")
.body("{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"63e10d4ed4df923a8dda34d0\",\n \"name\": \"COLOR\"\n },\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ]\n }\n ],\n \"variants\": [\n {\n \"_id\": \"63f76655c31eea543580fdda\",\n \"alwaysInStock\": true,\n \"costPrice\": null,\n \"digital_download\": {\n \"maxDownloadsPerOrder\": 5,\n \"name\": \"sample.pdf\",\n \"type\": \"application/pdf\",\n \"url\": \"https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/\",\n \"uuid\": \"92aaca76-e073-4a62-8244-5ea8c3c521b8\"\n },\n \"isActive\": false,\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ],\n \"price\": 17800,\n \"sale_price\": 17300,\n \"sku\": \"digital-with-variant-2-gold-0fdd9\",\n \"stock\": 1\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://staging.qshop.ng/apiv2/{shopId}/products/63f76655c31eea543580fddc")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"63e10d4ed4df923a8dda34d0\",\n \"name\": \"COLOR\"\n },\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ]\n }\n ],\n \"variants\": [\n {\n \"_id\": \"63f76655c31eea543580fdda\",\n \"alwaysInStock\": true,\n \"costPrice\": null,\n \"digital_download\": {\n \"maxDownloadsPerOrder\": 5,\n \"name\": \"sample.pdf\",\n \"type\": \"application/pdf\",\n \"url\": \"https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/\",\n \"uuid\": \"92aaca76-e073-4a62-8244-5ea8c3c521b8\"\n },\n \"isActive\": false,\n \"options\": [\n {\n \"id\": \"63e10d4ed4df923a8dda34ce\",\n \"label\": \"COLOR\",\n \"name\": \"GOLD\"\n }\n ],\n \"price\": 17800,\n \"sale_price\": 17300,\n \"sku\": \"digital-with-variant-2-gold-0fdd9\",\n \"stock\": 1\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyBody
application/json
Show child attributes
Show child attributes
Example:
[
{
"name": {
"_id": "63e10d4ed4df923a8dda34d0",
"name": "COLOR"
},
"options": [
{
"id": "63e10d4ed4df923a8dda34ce",
"label": "COLOR",
"name": "GOLD"
}
]
}
]
Show child attributes
Show child attributes
Example:
[
{
"_id": "63f76655c31eea543580fdda",
"alwaysInStock": true,
"costPrice": null,
"digital_download": {
"maxDownloadsPerOrder": 5,
"name": "sample.pdf",
"type": "application/pdf",
"url": "https://ucarecdn.com/92aaca76-e073-4a62-8244-5ea8c3c521b8/",
"uuid": "92aaca76-e073-4a62-8244-5ea8c3c521b8"
},
"isActive": false,
"options": [
{
"id": "63e10d4ed4df923a8dda34ce",
"label": "COLOR",
"name": "GOLD"
}
],
"price": 17800,
"sale_price": 17300,
"sku": "digital-with-variant-2-gold-0fdd9",
"stock": 1
}
]
Response
200 - undefined
Was this page helpful?
⌘I