Create product
curl --request POST \
--url http://staging.qshop.ng/apiv2/{shopId}/products \
--header 'Content-Type: application/json' \
--data '
{
"attributes": [
{
"name": {
"_id": "620230e20d148855678615ce",
"name": "Colorer"
},
"options": [
{
"label": "Colorer",
"name": "Space grey test-1"
},
{
"label": "Colorer",
"name": "Black test-1"
}
]
}
],
"brand": "Toyota",
"costPrice": null,
"dimension": {
"height": 7,
"length": 30,
"unit": "m",
"width": 50
},
"name": "Toyota corolla",
"price": 5000000,
"tags": [
"Cars"
],
"type": "physical",
"variants": [
{
"costPrice": 2900000,
"isActive": false,
"options": [
{
"label": "Colorer",
"name": "Space grey test-1"
}
],
"price": 3100000,
"stock": 5,
"weight": {
"unit": "kg",
"value": 20000
}
},
{
"costPrice": null,
"isActive": true,
"options": [
{
"label": "Colorer",
"name": "Black test-1"
}
],
"price": 3000000,
"stock": 5,
"weight": {
"unit": "kg",
"value": 20000
}
}
],
"variantsInheritPrice": false,
"weight": {
"unit": "kg",
"value": 20000
}
}
'import requests
url = "http://staging.qshop.ng/apiv2/{shopId}/products"
payload = {
"attributes": [
{
"name": {
"_id": "620230e20d148855678615ce",
"name": "Colorer"
},
"options": [
{
"label": "Colorer",
"name": "Space grey test-1"
},
{
"label": "Colorer",
"name": "Black test-1"
}
]
}
],
"brand": "Toyota",
"costPrice": None,
"dimension": {
"height": 7,
"length": 30,
"unit": "m",
"width": 50
},
"name": "Toyota corolla",
"price": 5000000,
"tags": ["Cars"],
"type": "physical",
"variants": [
{
"costPrice": 2900000,
"isActive": False,
"options": [
{
"label": "Colorer",
"name": "Space grey test-1"
}
],
"price": 3100000,
"stock": 5,
"weight": {
"unit": "kg",
"value": 20000
}
},
{
"costPrice": None,
"isActive": True,
"options": [
{
"label": "Colorer",
"name": "Black test-1"
}
],
"price": 3000000,
"stock": 5,
"weight": {
"unit": "kg",
"value": 20000
}
}
],
"variantsInheritPrice": False,
"weight": {
"unit": "kg",
"value": 20000
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
attributes: [
{
name: {_id: '620230e20d148855678615ce', name: 'Colorer'},
options: [
{label: 'Colorer', name: 'Space grey test-1'},
{label: 'Colorer', name: 'Black test-1'}
]
}
],
brand: 'Toyota',
costPrice: null,
dimension: {height: 7, length: 30, unit: 'm', width: 50},
name: 'Toyota corolla',
price: 5000000,
tags: ['Cars'],
type: 'physical',
variants: [
{
costPrice: 2900000,
isActive: false,
options: [{label: 'Colorer', name: 'Space grey test-1'}],
price: 3100000,
stock: 5,
weight: {unit: 'kg', value: 20000}
},
{
costPrice: null,
isActive: true,
options: [{label: 'Colorer', name: 'Black test-1'}],
price: 3000000,
stock: 5,
weight: {unit: 'kg', value: 20000}
}
],
variantsInheritPrice: false,
weight: {unit: 'kg', value: 20000}
})
};
fetch('http://staging.qshop.ng/apiv2/{shopId}/products', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'attributes' => [
[
'name' => [
'_id' => '620230e20d148855678615ce',
'name' => 'Colorer'
],
'options' => [
[
'label' => 'Colorer',
'name' => 'Space grey test-1'
],
[
'label' => 'Colorer',
'name' => 'Black test-1'
]
]
]
],
'brand' => 'Toyota',
'costPrice' => null,
'dimension' => [
'height' => 7,
'length' => 30,
'unit' => 'm',
'width' => 50
],
'name' => 'Toyota corolla',
'price' => 5000000,
'tags' => [
'Cars'
],
'type' => 'physical',
'variants' => [
[
'costPrice' => 2900000,
'isActive' => false,
'options' => [
[
'label' => 'Colorer',
'name' => 'Space grey test-1'
]
],
'price' => 3100000,
'stock' => 5,
'weight' => [
'unit' => 'kg',
'value' => 20000
]
],
[
'costPrice' => null,
'isActive' => true,
'options' => [
[
'label' => 'Colorer',
'name' => 'Black test-1'
]
],
'price' => 3000000,
'stock' => 5,
'weight' => [
'unit' => 'kg',
'value' => 20000
]
]
],
'variantsInheritPrice' => false,
'weight' => [
'unit' => 'kg',
'value' => 20000
]
]),
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"
payload := strings.NewReader("{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"620230e20d148855678615ce\",\n \"name\": \"Colorer\"\n },\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n },\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ]\n }\n ],\n \"brand\": \"Toyota\",\n \"costPrice\": null,\n \"dimension\": {\n \"height\": 7,\n \"length\": 30,\n \"unit\": \"m\",\n \"width\": 50\n },\n \"name\": \"Toyota corolla\",\n \"price\": 5000000,\n \"tags\": [\n \"Cars\"\n ],\n \"type\": \"physical\",\n \"variants\": [\n {\n \"costPrice\": 2900000,\n \"isActive\": false,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n }\n ],\n \"price\": 3100000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n },\n {\n \"costPrice\": null,\n \"isActive\": true,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ],\n \"price\": 3000000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n }\n ],\n \"variantsInheritPrice\": false,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n}")
req, _ := http.NewRequest("POST", 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.post("http://staging.qshop.ng/apiv2/{shopId}/products")
.header("Content-Type", "application/json")
.body("{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"620230e20d148855678615ce\",\n \"name\": \"Colorer\"\n },\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n },\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ]\n }\n ],\n \"brand\": \"Toyota\",\n \"costPrice\": null,\n \"dimension\": {\n \"height\": 7,\n \"length\": 30,\n \"unit\": \"m\",\n \"width\": 50\n },\n \"name\": \"Toyota corolla\",\n \"price\": 5000000,\n \"tags\": [\n \"Cars\"\n ],\n \"type\": \"physical\",\n \"variants\": [\n {\n \"costPrice\": 2900000,\n \"isActive\": false,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n }\n ],\n \"price\": 3100000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n },\n {\n \"costPrice\": null,\n \"isActive\": true,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ],\n \"price\": 3000000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n }\n ],\n \"variantsInheritPrice\": false,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://staging.qshop.ng/apiv2/{shopId}/products")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"620230e20d148855678615ce\",\n \"name\": \"Colorer\"\n },\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n },\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ]\n }\n ],\n \"brand\": \"Toyota\",\n \"costPrice\": null,\n \"dimension\": {\n \"height\": 7,\n \"length\": 30,\n \"unit\": \"m\",\n \"width\": 50\n },\n \"name\": \"Toyota corolla\",\n \"price\": 5000000,\n \"tags\": [\n \"Cars\"\n ],\n \"type\": \"physical\",\n \"variants\": [\n {\n \"costPrice\": 2900000,\n \"isActive\": false,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n }\n ],\n \"price\": 3100000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n },\n {\n \"costPrice\": null,\n \"isActive\": true,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ],\n \"price\": 3000000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n }\n ],\n \"variantsInheritPrice\": false,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n}"
response = http.request(request)
puts response.read_bodyProducts
Create product
POST
/
{shopId}
/
products
Create product
curl --request POST \
--url http://staging.qshop.ng/apiv2/{shopId}/products \
--header 'Content-Type: application/json' \
--data '
{
"attributes": [
{
"name": {
"_id": "620230e20d148855678615ce",
"name": "Colorer"
},
"options": [
{
"label": "Colorer",
"name": "Space grey test-1"
},
{
"label": "Colorer",
"name": "Black test-1"
}
]
}
],
"brand": "Toyota",
"costPrice": null,
"dimension": {
"height": 7,
"length": 30,
"unit": "m",
"width": 50
},
"name": "Toyota corolla",
"price": 5000000,
"tags": [
"Cars"
],
"type": "physical",
"variants": [
{
"costPrice": 2900000,
"isActive": false,
"options": [
{
"label": "Colorer",
"name": "Space grey test-1"
}
],
"price": 3100000,
"stock": 5,
"weight": {
"unit": "kg",
"value": 20000
}
},
{
"costPrice": null,
"isActive": true,
"options": [
{
"label": "Colorer",
"name": "Black test-1"
}
],
"price": 3000000,
"stock": 5,
"weight": {
"unit": "kg",
"value": 20000
}
}
],
"variantsInheritPrice": false,
"weight": {
"unit": "kg",
"value": 20000
}
}
'import requests
url = "http://staging.qshop.ng/apiv2/{shopId}/products"
payload = {
"attributes": [
{
"name": {
"_id": "620230e20d148855678615ce",
"name": "Colorer"
},
"options": [
{
"label": "Colorer",
"name": "Space grey test-1"
},
{
"label": "Colorer",
"name": "Black test-1"
}
]
}
],
"brand": "Toyota",
"costPrice": None,
"dimension": {
"height": 7,
"length": 30,
"unit": "m",
"width": 50
},
"name": "Toyota corolla",
"price": 5000000,
"tags": ["Cars"],
"type": "physical",
"variants": [
{
"costPrice": 2900000,
"isActive": False,
"options": [
{
"label": "Colorer",
"name": "Space grey test-1"
}
],
"price": 3100000,
"stock": 5,
"weight": {
"unit": "kg",
"value": 20000
}
},
{
"costPrice": None,
"isActive": True,
"options": [
{
"label": "Colorer",
"name": "Black test-1"
}
],
"price": 3000000,
"stock": 5,
"weight": {
"unit": "kg",
"value": 20000
}
}
],
"variantsInheritPrice": False,
"weight": {
"unit": "kg",
"value": 20000
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
attributes: [
{
name: {_id: '620230e20d148855678615ce', name: 'Colorer'},
options: [
{label: 'Colorer', name: 'Space grey test-1'},
{label: 'Colorer', name: 'Black test-1'}
]
}
],
brand: 'Toyota',
costPrice: null,
dimension: {height: 7, length: 30, unit: 'm', width: 50},
name: 'Toyota corolla',
price: 5000000,
tags: ['Cars'],
type: 'physical',
variants: [
{
costPrice: 2900000,
isActive: false,
options: [{label: 'Colorer', name: 'Space grey test-1'}],
price: 3100000,
stock: 5,
weight: {unit: 'kg', value: 20000}
},
{
costPrice: null,
isActive: true,
options: [{label: 'Colorer', name: 'Black test-1'}],
price: 3000000,
stock: 5,
weight: {unit: 'kg', value: 20000}
}
],
variantsInheritPrice: false,
weight: {unit: 'kg', value: 20000}
})
};
fetch('http://staging.qshop.ng/apiv2/{shopId}/products', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'attributes' => [
[
'name' => [
'_id' => '620230e20d148855678615ce',
'name' => 'Colorer'
],
'options' => [
[
'label' => 'Colorer',
'name' => 'Space grey test-1'
],
[
'label' => 'Colorer',
'name' => 'Black test-1'
]
]
]
],
'brand' => 'Toyota',
'costPrice' => null,
'dimension' => [
'height' => 7,
'length' => 30,
'unit' => 'm',
'width' => 50
],
'name' => 'Toyota corolla',
'price' => 5000000,
'tags' => [
'Cars'
],
'type' => 'physical',
'variants' => [
[
'costPrice' => 2900000,
'isActive' => false,
'options' => [
[
'label' => 'Colorer',
'name' => 'Space grey test-1'
]
],
'price' => 3100000,
'stock' => 5,
'weight' => [
'unit' => 'kg',
'value' => 20000
]
],
[
'costPrice' => null,
'isActive' => true,
'options' => [
[
'label' => 'Colorer',
'name' => 'Black test-1'
]
],
'price' => 3000000,
'stock' => 5,
'weight' => [
'unit' => 'kg',
'value' => 20000
]
]
],
'variantsInheritPrice' => false,
'weight' => [
'unit' => 'kg',
'value' => 20000
]
]),
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"
payload := strings.NewReader("{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"620230e20d148855678615ce\",\n \"name\": \"Colorer\"\n },\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n },\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ]\n }\n ],\n \"brand\": \"Toyota\",\n \"costPrice\": null,\n \"dimension\": {\n \"height\": 7,\n \"length\": 30,\n \"unit\": \"m\",\n \"width\": 50\n },\n \"name\": \"Toyota corolla\",\n \"price\": 5000000,\n \"tags\": [\n \"Cars\"\n ],\n \"type\": \"physical\",\n \"variants\": [\n {\n \"costPrice\": 2900000,\n \"isActive\": false,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n }\n ],\n \"price\": 3100000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n },\n {\n \"costPrice\": null,\n \"isActive\": true,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ],\n \"price\": 3000000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n }\n ],\n \"variantsInheritPrice\": false,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n}")
req, _ := http.NewRequest("POST", 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.post("http://staging.qshop.ng/apiv2/{shopId}/products")
.header("Content-Type", "application/json")
.body("{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"620230e20d148855678615ce\",\n \"name\": \"Colorer\"\n },\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n },\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ]\n }\n ],\n \"brand\": \"Toyota\",\n \"costPrice\": null,\n \"dimension\": {\n \"height\": 7,\n \"length\": 30,\n \"unit\": \"m\",\n \"width\": 50\n },\n \"name\": \"Toyota corolla\",\n \"price\": 5000000,\n \"tags\": [\n \"Cars\"\n ],\n \"type\": \"physical\",\n \"variants\": [\n {\n \"costPrice\": 2900000,\n \"isActive\": false,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n }\n ],\n \"price\": 3100000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n },\n {\n \"costPrice\": null,\n \"isActive\": true,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ],\n \"price\": 3000000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n }\n ],\n \"variantsInheritPrice\": false,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://staging.qshop.ng/apiv2/{shopId}/products")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"attributes\": [\n {\n \"name\": {\n \"_id\": \"620230e20d148855678615ce\",\n \"name\": \"Colorer\"\n },\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n },\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ]\n }\n ],\n \"brand\": \"Toyota\",\n \"costPrice\": null,\n \"dimension\": {\n \"height\": 7,\n \"length\": 30,\n \"unit\": \"m\",\n \"width\": 50\n },\n \"name\": \"Toyota corolla\",\n \"price\": 5000000,\n \"tags\": [\n \"Cars\"\n ],\n \"type\": \"physical\",\n \"variants\": [\n {\n \"costPrice\": 2900000,\n \"isActive\": false,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Space grey test-1\"\n }\n ],\n \"price\": 3100000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n },\n {\n \"costPrice\": null,\n \"isActive\": true,\n \"options\": [\n {\n \"label\": \"Colorer\",\n \"name\": \"Black test-1\"\n }\n ],\n \"price\": 3000000,\n \"stock\": 5,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n }\n ],\n \"variantsInheritPrice\": false,\n \"weight\": {\n \"unit\": \"kg\",\n \"value\": 20000\n }\n}"
response = http.request(request)
puts response.read_bodyBody
application/json
Show child attributes
Show child attributes
Example:
[
{
"name": {
"_id": "620230e20d148855678615ce",
"name": "Colorer"
},
"options": [
{
"label": "Colorer",
"name": "Space grey test-1"
},
{
"label": "Colorer",
"name": "Black test-1"
}
]
}
]
Example:
"Toyota"
Show child attributes
Show child attributes
Example:
"Toyota corolla"
Example:
5000000
Example:
["Cars"]
Example:
"physical"
Show child attributes
Show child attributes
Example:
[
{
"costPrice": 2900000,
"isActive": false,
"options": [
{
"label": "Colorer",
"name": "Space grey test-1"
}
],
"price": 3100000,
"stock": 5,
"weight": { "unit": "kg", "value": 20000 }
},
{
"costPrice": null,
"isActive": true,
"options": [
{
"label": "Colorer",
"name": "Black test-1"
}
],
"price": 3000000,
"stock": 5,
"weight": { "unit": "kg", "value": 20000 }
}
]
Example:
false
Show child attributes
Show child attributes
Response
200 - undefined
Was this page helpful?
⌘I