Create shop coupon Copy
curl --request POST \
--url http://staging.qshop.ng/apiv2/{shopId}/coupons \
--header 'Content-Type: application/json' \
--data '
{
"_id": "63d90762691c5a2faaa91c76",
"amount": 5000,
"applyAutomatically": false,
"applyOn": "total",
"code": "947PG8G",
"code_type": "flat",
"created": "2023-01-31T12:19:46.767Z",
"description": "",
"expires": "2023-02-03T23:00:00.000Z",
"isActive": true,
"isPublic": false,
"max_order": null,
"mediaType": null,
"min_order": 0,
"shop": "62dec73d93a7452ccf49ea2f",
"starts": "2023-01-31T12:19:24.552Z",
"usageCount": 0,
"usageLimit": {
"canUseWithOtherCoupons": false,
"maxNumberOfUses": 0,
"maxNumberOfUsesPerUser": null,
"useIfNumberOfOrders": {
"count": null
}
},
"usageRestriction": {
"categories": {
"condition": "or",
"contains": []
},
"products": {
"condition": "or",
"contains": []
},
"roles": {
"accept": [],
"exclude": []
},
"tags": {
"condition": "or",
"contains": []
},
"users": {
"condition": "all",
"contains": []
}
}
}
'import requests
url = "http://staging.qshop.ng/apiv2/{shopId}/coupons"
payload = {
"_id": "63d90762691c5a2faaa91c76",
"amount": 5000,
"applyAutomatically": False,
"applyOn": "total",
"code": "947PG8G",
"code_type": "flat",
"created": "2023-01-31T12:19:46.767Z",
"description": "",
"expires": "2023-02-03T23:00:00.000Z",
"isActive": True,
"isPublic": False,
"max_order": None,
"mediaType": None,
"min_order": 0,
"shop": "62dec73d93a7452ccf49ea2f",
"starts": "2023-01-31T12:19:24.552Z",
"usageCount": 0,
"usageLimit": {
"canUseWithOtherCoupons": False,
"maxNumberOfUses": 0,
"maxNumberOfUsesPerUser": None,
"useIfNumberOfOrders": { "count": None }
},
"usageRestriction": {
"categories": {
"condition": "or",
"contains": []
},
"products": {
"condition": "or",
"contains": []
},
"roles": {
"accept": [],
"exclude": []
},
"tags": {
"condition": "or",
"contains": []
},
"users": {
"condition": "all",
"contains": []
}
}
}
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({
_id: '63d90762691c5a2faaa91c76',
amount: 5000,
applyAutomatically: false,
applyOn: 'total',
code: '947PG8G',
code_type: 'flat',
created: '2023-01-31T12:19:46.767Z',
description: '',
expires: '2023-02-03T23:00:00.000Z',
isActive: true,
isPublic: false,
max_order: null,
mediaType: null,
min_order: 0,
shop: '62dec73d93a7452ccf49ea2f',
starts: '2023-01-31T12:19:24.552Z',
usageCount: 0,
usageLimit: {
canUseWithOtherCoupons: false,
maxNumberOfUses: 0,
maxNumberOfUsesPerUser: null,
useIfNumberOfOrders: {count: null}
},
usageRestriction: {
categories: {condition: 'or', contains: []},
products: {condition: 'or', contains: []},
roles: {accept: [], exclude: []},
tags: {condition: 'or', contains: []},
users: {condition: 'all', contains: []}
}
})
};
fetch('http://staging.qshop.ng/apiv2/{shopId}/coupons', 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}/coupons",
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([
'_id' => '63d90762691c5a2faaa91c76',
'amount' => 5000,
'applyAutomatically' => false,
'applyOn' => 'total',
'code' => '947PG8G',
'code_type' => 'flat',
'created' => '2023-01-31T12:19:46.767Z',
'description' => '',
'expires' => '2023-02-03T23:00:00.000Z',
'isActive' => true,
'isPublic' => false,
'max_order' => null,
'mediaType' => null,
'min_order' => 0,
'shop' => '62dec73d93a7452ccf49ea2f',
'starts' => '2023-01-31T12:19:24.552Z',
'usageCount' => 0,
'usageLimit' => [
'canUseWithOtherCoupons' => false,
'maxNumberOfUses' => 0,
'maxNumberOfUsesPerUser' => null,
'useIfNumberOfOrders' => [
'count' => null
]
],
'usageRestriction' => [
'categories' => [
'condition' => 'or',
'contains' => [
]
],
'products' => [
'condition' => 'or',
'contains' => [
]
],
'roles' => [
'accept' => [
],
'exclude' => [
]
],
'tags' => [
'condition' => 'or',
'contains' => [
]
],
'users' => [
'condition' => 'all',
'contains' => [
]
]
]
]),
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}/coupons"
payload := strings.NewReader("{\n \"_id\": \"63d90762691c5a2faaa91c76\",\n \"amount\": 5000,\n \"applyAutomatically\": false,\n \"applyOn\": \"total\",\n \"code\": \"947PG8G\",\n \"code_type\": \"flat\",\n \"created\": \"2023-01-31T12:19:46.767Z\",\n \"description\": \"\",\n \"expires\": \"2023-02-03T23:00:00.000Z\",\n \"isActive\": true,\n \"isPublic\": false,\n \"max_order\": null,\n \"mediaType\": null,\n \"min_order\": 0,\n \"shop\": \"62dec73d93a7452ccf49ea2f\",\n \"starts\": \"2023-01-31T12:19:24.552Z\",\n \"usageCount\": 0,\n \"usageLimit\": {\n \"canUseWithOtherCoupons\": false,\n \"maxNumberOfUses\": 0,\n \"maxNumberOfUsesPerUser\": null,\n \"useIfNumberOfOrders\": {\n \"count\": null\n }\n },\n \"usageRestriction\": {\n \"categories\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"products\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"roles\": {\n \"accept\": [],\n \"exclude\": []\n },\n \"tags\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"users\": {\n \"condition\": \"all\",\n \"contains\": []\n }\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}/coupons")
.header("Content-Type", "application/json")
.body("{\n \"_id\": \"63d90762691c5a2faaa91c76\",\n \"amount\": 5000,\n \"applyAutomatically\": false,\n \"applyOn\": \"total\",\n \"code\": \"947PG8G\",\n \"code_type\": \"flat\",\n \"created\": \"2023-01-31T12:19:46.767Z\",\n \"description\": \"\",\n \"expires\": \"2023-02-03T23:00:00.000Z\",\n \"isActive\": true,\n \"isPublic\": false,\n \"max_order\": null,\n \"mediaType\": null,\n \"min_order\": 0,\n \"shop\": \"62dec73d93a7452ccf49ea2f\",\n \"starts\": \"2023-01-31T12:19:24.552Z\",\n \"usageCount\": 0,\n \"usageLimit\": {\n \"canUseWithOtherCoupons\": false,\n \"maxNumberOfUses\": 0,\n \"maxNumberOfUsesPerUser\": null,\n \"useIfNumberOfOrders\": {\n \"count\": null\n }\n },\n \"usageRestriction\": {\n \"categories\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"products\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"roles\": {\n \"accept\": [],\n \"exclude\": []\n },\n \"tags\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"users\": {\n \"condition\": \"all\",\n \"contains\": []\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://staging.qshop.ng/apiv2/{shopId}/coupons")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"_id\": \"63d90762691c5a2faaa91c76\",\n \"amount\": 5000,\n \"applyAutomatically\": false,\n \"applyOn\": \"total\",\n \"code\": \"947PG8G\",\n \"code_type\": \"flat\",\n \"created\": \"2023-01-31T12:19:46.767Z\",\n \"description\": \"\",\n \"expires\": \"2023-02-03T23:00:00.000Z\",\n \"isActive\": true,\n \"isPublic\": false,\n \"max_order\": null,\n \"mediaType\": null,\n \"min_order\": 0,\n \"shop\": \"62dec73d93a7452ccf49ea2f\",\n \"starts\": \"2023-01-31T12:19:24.552Z\",\n \"usageCount\": 0,\n \"usageLimit\": {\n \"canUseWithOtherCoupons\": false,\n \"maxNumberOfUses\": 0,\n \"maxNumberOfUsesPerUser\": null,\n \"useIfNumberOfOrders\": {\n \"count\": null\n }\n },\n \"usageRestriction\": {\n \"categories\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"products\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"roles\": {\n \"accept\": [],\n \"exclude\": []\n },\n \"tags\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"users\": {\n \"condition\": \"all\",\n \"contains\": []\n }\n }\n}"
response = http.request(request)
puts response.read_bodyCoupons
Create shop coupon copy
POST
/
{shopId}
/
coupons
Create shop coupon Copy
curl --request POST \
--url http://staging.qshop.ng/apiv2/{shopId}/coupons \
--header 'Content-Type: application/json' \
--data '
{
"_id": "63d90762691c5a2faaa91c76",
"amount": 5000,
"applyAutomatically": false,
"applyOn": "total",
"code": "947PG8G",
"code_type": "flat",
"created": "2023-01-31T12:19:46.767Z",
"description": "",
"expires": "2023-02-03T23:00:00.000Z",
"isActive": true,
"isPublic": false,
"max_order": null,
"mediaType": null,
"min_order": 0,
"shop": "62dec73d93a7452ccf49ea2f",
"starts": "2023-01-31T12:19:24.552Z",
"usageCount": 0,
"usageLimit": {
"canUseWithOtherCoupons": false,
"maxNumberOfUses": 0,
"maxNumberOfUsesPerUser": null,
"useIfNumberOfOrders": {
"count": null
}
},
"usageRestriction": {
"categories": {
"condition": "or",
"contains": []
},
"products": {
"condition": "or",
"contains": []
},
"roles": {
"accept": [],
"exclude": []
},
"tags": {
"condition": "or",
"contains": []
},
"users": {
"condition": "all",
"contains": []
}
}
}
'import requests
url = "http://staging.qshop.ng/apiv2/{shopId}/coupons"
payload = {
"_id": "63d90762691c5a2faaa91c76",
"amount": 5000,
"applyAutomatically": False,
"applyOn": "total",
"code": "947PG8G",
"code_type": "flat",
"created": "2023-01-31T12:19:46.767Z",
"description": "",
"expires": "2023-02-03T23:00:00.000Z",
"isActive": True,
"isPublic": False,
"max_order": None,
"mediaType": None,
"min_order": 0,
"shop": "62dec73d93a7452ccf49ea2f",
"starts": "2023-01-31T12:19:24.552Z",
"usageCount": 0,
"usageLimit": {
"canUseWithOtherCoupons": False,
"maxNumberOfUses": 0,
"maxNumberOfUsesPerUser": None,
"useIfNumberOfOrders": { "count": None }
},
"usageRestriction": {
"categories": {
"condition": "or",
"contains": []
},
"products": {
"condition": "or",
"contains": []
},
"roles": {
"accept": [],
"exclude": []
},
"tags": {
"condition": "or",
"contains": []
},
"users": {
"condition": "all",
"contains": []
}
}
}
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({
_id: '63d90762691c5a2faaa91c76',
amount: 5000,
applyAutomatically: false,
applyOn: 'total',
code: '947PG8G',
code_type: 'flat',
created: '2023-01-31T12:19:46.767Z',
description: '',
expires: '2023-02-03T23:00:00.000Z',
isActive: true,
isPublic: false,
max_order: null,
mediaType: null,
min_order: 0,
shop: '62dec73d93a7452ccf49ea2f',
starts: '2023-01-31T12:19:24.552Z',
usageCount: 0,
usageLimit: {
canUseWithOtherCoupons: false,
maxNumberOfUses: 0,
maxNumberOfUsesPerUser: null,
useIfNumberOfOrders: {count: null}
},
usageRestriction: {
categories: {condition: 'or', contains: []},
products: {condition: 'or', contains: []},
roles: {accept: [], exclude: []},
tags: {condition: 'or', contains: []},
users: {condition: 'all', contains: []}
}
})
};
fetch('http://staging.qshop.ng/apiv2/{shopId}/coupons', 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}/coupons",
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([
'_id' => '63d90762691c5a2faaa91c76',
'amount' => 5000,
'applyAutomatically' => false,
'applyOn' => 'total',
'code' => '947PG8G',
'code_type' => 'flat',
'created' => '2023-01-31T12:19:46.767Z',
'description' => '',
'expires' => '2023-02-03T23:00:00.000Z',
'isActive' => true,
'isPublic' => false,
'max_order' => null,
'mediaType' => null,
'min_order' => 0,
'shop' => '62dec73d93a7452ccf49ea2f',
'starts' => '2023-01-31T12:19:24.552Z',
'usageCount' => 0,
'usageLimit' => [
'canUseWithOtherCoupons' => false,
'maxNumberOfUses' => 0,
'maxNumberOfUsesPerUser' => null,
'useIfNumberOfOrders' => [
'count' => null
]
],
'usageRestriction' => [
'categories' => [
'condition' => 'or',
'contains' => [
]
],
'products' => [
'condition' => 'or',
'contains' => [
]
],
'roles' => [
'accept' => [
],
'exclude' => [
]
],
'tags' => [
'condition' => 'or',
'contains' => [
]
],
'users' => [
'condition' => 'all',
'contains' => [
]
]
]
]),
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}/coupons"
payload := strings.NewReader("{\n \"_id\": \"63d90762691c5a2faaa91c76\",\n \"amount\": 5000,\n \"applyAutomatically\": false,\n \"applyOn\": \"total\",\n \"code\": \"947PG8G\",\n \"code_type\": \"flat\",\n \"created\": \"2023-01-31T12:19:46.767Z\",\n \"description\": \"\",\n \"expires\": \"2023-02-03T23:00:00.000Z\",\n \"isActive\": true,\n \"isPublic\": false,\n \"max_order\": null,\n \"mediaType\": null,\n \"min_order\": 0,\n \"shop\": \"62dec73d93a7452ccf49ea2f\",\n \"starts\": \"2023-01-31T12:19:24.552Z\",\n \"usageCount\": 0,\n \"usageLimit\": {\n \"canUseWithOtherCoupons\": false,\n \"maxNumberOfUses\": 0,\n \"maxNumberOfUsesPerUser\": null,\n \"useIfNumberOfOrders\": {\n \"count\": null\n }\n },\n \"usageRestriction\": {\n \"categories\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"products\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"roles\": {\n \"accept\": [],\n \"exclude\": []\n },\n \"tags\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"users\": {\n \"condition\": \"all\",\n \"contains\": []\n }\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}/coupons")
.header("Content-Type", "application/json")
.body("{\n \"_id\": \"63d90762691c5a2faaa91c76\",\n \"amount\": 5000,\n \"applyAutomatically\": false,\n \"applyOn\": \"total\",\n \"code\": \"947PG8G\",\n \"code_type\": \"flat\",\n \"created\": \"2023-01-31T12:19:46.767Z\",\n \"description\": \"\",\n \"expires\": \"2023-02-03T23:00:00.000Z\",\n \"isActive\": true,\n \"isPublic\": false,\n \"max_order\": null,\n \"mediaType\": null,\n \"min_order\": 0,\n \"shop\": \"62dec73d93a7452ccf49ea2f\",\n \"starts\": \"2023-01-31T12:19:24.552Z\",\n \"usageCount\": 0,\n \"usageLimit\": {\n \"canUseWithOtherCoupons\": false,\n \"maxNumberOfUses\": 0,\n \"maxNumberOfUsesPerUser\": null,\n \"useIfNumberOfOrders\": {\n \"count\": null\n }\n },\n \"usageRestriction\": {\n \"categories\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"products\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"roles\": {\n \"accept\": [],\n \"exclude\": []\n },\n \"tags\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"users\": {\n \"condition\": \"all\",\n \"contains\": []\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://staging.qshop.ng/apiv2/{shopId}/coupons")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"_id\": \"63d90762691c5a2faaa91c76\",\n \"amount\": 5000,\n \"applyAutomatically\": false,\n \"applyOn\": \"total\",\n \"code\": \"947PG8G\",\n \"code_type\": \"flat\",\n \"created\": \"2023-01-31T12:19:46.767Z\",\n \"description\": \"\",\n \"expires\": \"2023-02-03T23:00:00.000Z\",\n \"isActive\": true,\n \"isPublic\": false,\n \"max_order\": null,\n \"mediaType\": null,\n \"min_order\": 0,\n \"shop\": \"62dec73d93a7452ccf49ea2f\",\n \"starts\": \"2023-01-31T12:19:24.552Z\",\n \"usageCount\": 0,\n \"usageLimit\": {\n \"canUseWithOtherCoupons\": false,\n \"maxNumberOfUses\": 0,\n \"maxNumberOfUsesPerUser\": null,\n \"useIfNumberOfOrders\": {\n \"count\": null\n }\n },\n \"usageRestriction\": {\n \"categories\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"products\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"roles\": {\n \"accept\": [],\n \"exclude\": []\n },\n \"tags\": {\n \"condition\": \"or\",\n \"contains\": []\n },\n \"users\": {\n \"condition\": \"all\",\n \"contains\": []\n }\n }\n}"
response = http.request(request)
puts response.read_bodyBody
application/json
Example:
"63d90762691c5a2faaa91c76"
Example:
5000
Example:
false
Example:
"total"
Example:
"947PG8G"
Example:
"flat"
Example:
"2023-01-31T12:19:46.767Z"
Example:
""
Example:
"2023-02-03T23:00:00.000Z"
Example:
true
Example:
false
Example:
0
Example:
"62dec73d93a7452ccf49ea2f"
Example:
"2023-01-31T12:19:24.552Z"
Example:
0
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
200 - undefined
Was this page helpful?
⌘I