Create Cart
curl --request POST \
--url http://staging.qshop.ng/apiv2/shops/{shopId}/cart \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"_id": "<string>",
"name": "<string>",
"qty": 123,
"variant": {
"_id": "<string>"
}
}
],
"email": "<string>"
}
'import requests
url = "http://staging.qshop.ng/apiv2/shops/{shopId}/cart"
payload = {
"items": [
{
"_id": "<string>",
"name": "<string>",
"qty": 123,
"variant": { "_id": "<string>" }
}
],
"email": "<string>"
}
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({
items: [{_id: '<string>', name: '<string>', qty: 123, variant: {_id: '<string>'}}],
email: '<string>'
})
};
fetch('http://staging.qshop.ng/apiv2/shops/{shopId}/cart', 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/shops/{shopId}/cart",
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([
'items' => [
[
'_id' => '<string>',
'name' => '<string>',
'qty' => 123,
'variant' => [
'_id' => '<string>'
]
]
],
'email' => '<string>'
]),
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/shops/{shopId}/cart"
payload := strings.NewReader("{\n \"items\": [\n {\n \"_id\": \"<string>\",\n \"name\": \"<string>\",\n \"qty\": 123,\n \"variant\": {\n \"_id\": \"<string>\"\n }\n }\n ],\n \"email\": \"<string>\"\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/shops/{shopId}/cart")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"_id\": \"<string>\",\n \"name\": \"<string>\",\n \"qty\": 123,\n \"variant\": {\n \"_id\": \"<string>\"\n }\n }\n ],\n \"email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://staging.qshop.ng/apiv2/shops/{shopId}/cart")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"_id\": \"<string>\",\n \"name\": \"<string>\",\n \"qty\": 123,\n \"variant\": {\n \"_id\": \"<string>\"\n }\n }\n ],\n \"email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"msg": "<string>",
"data": {
"entityId": "<string>",
"shop": "<string>",
"email": "<string>",
"items": [
{
"_id": "<string>",
"tags": [
{
"_id": "<string>",
"name": "<string>",
"tempId": "<string>",
"shop": "<string>",
"__v": 123,
"slug": "<string>",
"productCount": 123,
"imageUrl": "<string>"
}
],
"stock": 123,
"digital": true,
"media": "<string>",
"media_type": "<string>",
"name": "<string>",
"price": 123,
"shop": "<string>",
"sale_price": 123,
"__v": 123,
"draft": true,
"alwaysInStock": true,
"costPrice": 123,
"sku": "<string>",
"type": "<string>",
"slug": "<string>",
"dimension": {
"unit": "<string>",
"length": 123,
"width": 123,
"height": 123
},
"weight": {
"base": {
"unit": "<string>",
"value": 123
},
"unit": "<string>",
"value": 123
},
"variantsInheritPrice": true,
"setAttributesForVariants": true,
"qty": 123,
"variant": {
"_id": "<string>",
"price": 123,
"sale_price": 123,
"costPrice": 123,
"stock": 123,
"alwaysInStock": true,
"isActive": true,
"sku": "<string>",
"weight": {
"base": {
"unit": "<string>",
"value": 123
},
"unit": "<string>",
"value": 123
},
"media": "<string>",
"digital_download": {
"name": "<string>",
"url": "<string>",
"uuid": "<string>",
"size": null,
"maxDownloadsPerOrder": null
},
"media_type": "<string>",
"dimension": {
"unit": "<string>",
"length": 123,
"width": 123,
"height": 123
},
"options": [
{
"label": "<string>",
"name": "<string>",
"id": "<string>"
}
]
},
"originalPrice": 123,
"finalPrice": 123,
"subTotal": 123,
"cartItemId": "<string>"
}
],
"subTotal": 123,
"total": 123,
"created": "<string>",
"_id": "<string>",
"discountsApplied": "<array>",
"discountAmount": 123,
"shipping": 123,
"shippingRate": null,
"user": null,
"exclusiveDiscount": true,
"order": null
},
"success": true
}Cart
Create Cart
Host: http://qshop.ng
POST
/
shops
/
{shopId}
/
cart
Create Cart
curl --request POST \
--url http://staging.qshop.ng/apiv2/shops/{shopId}/cart \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"_id": "<string>",
"name": "<string>",
"qty": 123,
"variant": {
"_id": "<string>"
}
}
],
"email": "<string>"
}
'import requests
url = "http://staging.qshop.ng/apiv2/shops/{shopId}/cart"
payload = {
"items": [
{
"_id": "<string>",
"name": "<string>",
"qty": 123,
"variant": { "_id": "<string>" }
}
],
"email": "<string>"
}
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({
items: [{_id: '<string>', name: '<string>', qty: 123, variant: {_id: '<string>'}}],
email: '<string>'
})
};
fetch('http://staging.qshop.ng/apiv2/shops/{shopId}/cart', 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/shops/{shopId}/cart",
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([
'items' => [
[
'_id' => '<string>',
'name' => '<string>',
'qty' => 123,
'variant' => [
'_id' => '<string>'
]
]
],
'email' => '<string>'
]),
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/shops/{shopId}/cart"
payload := strings.NewReader("{\n \"items\": [\n {\n \"_id\": \"<string>\",\n \"name\": \"<string>\",\n \"qty\": 123,\n \"variant\": {\n \"_id\": \"<string>\"\n }\n }\n ],\n \"email\": \"<string>\"\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/shops/{shopId}/cart")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"_id\": \"<string>\",\n \"name\": \"<string>\",\n \"qty\": 123,\n \"variant\": {\n \"_id\": \"<string>\"\n }\n }\n ],\n \"email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://staging.qshop.ng/apiv2/shops/{shopId}/cart")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"_id\": \"<string>\",\n \"name\": \"<string>\",\n \"qty\": 123,\n \"variant\": {\n \"_id\": \"<string>\"\n }\n }\n ],\n \"email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"msg": "<string>",
"data": {
"entityId": "<string>",
"shop": "<string>",
"email": "<string>",
"items": [
{
"_id": "<string>",
"tags": [
{
"_id": "<string>",
"name": "<string>",
"tempId": "<string>",
"shop": "<string>",
"__v": 123,
"slug": "<string>",
"productCount": 123,
"imageUrl": "<string>"
}
],
"stock": 123,
"digital": true,
"media": "<string>",
"media_type": "<string>",
"name": "<string>",
"price": 123,
"shop": "<string>",
"sale_price": 123,
"__v": 123,
"draft": true,
"alwaysInStock": true,
"costPrice": 123,
"sku": "<string>",
"type": "<string>",
"slug": "<string>",
"dimension": {
"unit": "<string>",
"length": 123,
"width": 123,
"height": 123
},
"weight": {
"base": {
"unit": "<string>",
"value": 123
},
"unit": "<string>",
"value": 123
},
"variantsInheritPrice": true,
"setAttributesForVariants": true,
"qty": 123,
"variant": {
"_id": "<string>",
"price": 123,
"sale_price": 123,
"costPrice": 123,
"stock": 123,
"alwaysInStock": true,
"isActive": true,
"sku": "<string>",
"weight": {
"base": {
"unit": "<string>",
"value": 123
},
"unit": "<string>",
"value": 123
},
"media": "<string>",
"digital_download": {
"name": "<string>",
"url": "<string>",
"uuid": "<string>",
"size": null,
"maxDownloadsPerOrder": null
},
"media_type": "<string>",
"dimension": {
"unit": "<string>",
"length": 123,
"width": 123,
"height": 123
},
"options": [
{
"label": "<string>",
"name": "<string>",
"id": "<string>"
}
]
},
"originalPrice": 123,
"finalPrice": 123,
"subTotal": 123,
"cartItemId": "<string>"
}
],
"subTotal": 123,
"total": 123,
"created": "<string>",
"_id": "<string>",
"discountsApplied": "<array>",
"discountAmount": 123,
"shipping": 123,
"shippingRate": null,
"user": null,
"exclusiveDiscount": true,
"order": null
},
"success": true
}Was this page helpful?
⌘I