CreateNewProduct
This endpoint is there to create new product
POST
https://sandbox.pgecom.com/api/v1/merchant/product
Headers
Name | Type | Description |
---|---|---|
Authorization* | String | Bearer {{token}} |
Request Body
Name | Type | Description |
---|---|---|
shopId* | String | The id of the shop |
name* | String | Name of the product |
price* | Number | The current price of the product |
description* | String | Product description |
mainImageUrl | String | The main image url |
comparePrice | Number | Discount price of the product |
costPerItem | Number | The amount of cost per item |
inventory | Number | Quantity of products in stock |
productType | String | Type of products (physical, digital, service) |
status | String | Product status (draft, active, archived) |
{
"name": "Hair",
"shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
"description": "This is another fantastic product. I am looking forward to doing it here",
"price": 50,
"productType": "digital",
"comparePrice": 0,
"inventory": 20,
"costPerItem": 0,
"status": "draft",
"mainImageUrl": "",
"id": "0ee6defd-2210-47f6-b624-07f79396ca2a",
"slug": "hair",
"isFeatured": false,
"isContinueSellingOutStock": false,
"published": false,
"vendor": "facebook",
"userID": "5f56dfa3-a415-4818-8275-44fc63ece3fd"
}
{
"message": "\"shopId\" is required",
"status": 500
}
{
"message": "Too many requests, please try again later.",
"status": 429
}
{
"message": "Token needs to be provided",
"status": 401
}
{
"message": "Shop with id 0a40d129-0728-b10-b32e-117abd6938c3 not found"
}
const axios = require('axios');
let data = {
"name": "Hair",
"shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
"description": "This is another fantastic product. I am looking forward to doing it here",
"id": "aa97f0b3-c13d-437d-8d06-d46f0f65a48b",
"price": "50",
"productType": "digital",
"comparePrice": 0,
"inventory": "20",
"costPerItem": 0,
"status": "draft",
"mainImageUrl": ""
}
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://sandbox.pgecom.com/api/v1/merchant/product',
headers: { },
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
import http.client
conn = http.client.HTTPSConnection("https://sandbox.pgecom.com")
payload = {
"name": "Hair",
"shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
"description": "This is another fantastic product. I am looking forward to doing it here",
"id": "aa97f0b3-c13d-437d-8d06-d46f0f65a48b",
"price": "50",
"productType": "digital",
"comparePrice": 0,
"inventory": "20",
"costPerItem": 0,
"status": "draft",
"mainImageUrl": ""
}
headers = {}
conn.request("POST", "/api/v1/merchant/product", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require "uri"
require "net/http"
url = URI("https://sandbox.pgecom.com/api/v1/merchant/product")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request.body = {
"name": "Hair",
"shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
"description": "This is another fantastic product. I am looking forward to doing it here",
"id": "aa97f0b3-c13d-437d-8d06-d46f0f65a48b",
"price": "50",
"productType": "digital",
"comparePrice": 0,
"inventory": "20",
"costPerItem": 0,
"status": "draft",
"mainImageUrl": ""
}
response = http.request(request)
puts response.read_body
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://sandbox.pgecom.com/api/v1/merchant/product');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setBody({
"name": "Hair",
"shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
"description": "This is another fantastic product. I am looking forward to doing it here",
"id": "aa97f0b3-c13d-437d-8d06-d46f0f65a48b",
"price": "50",
"productType": "digital",
"comparePrice": 0,
"inventory": "20",
"costPerItem": 0,
"status": "draft",
"mainImageUrl": ""
})
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
curl --location 'https://sandbox.pgecom.com/api/v1/merchant/product' \
--data '{
"name": "Hair",
"shopId": "0a40d129-0728-4b10-b32e-117abd6938c3",
"description": "This is another fantastic product. I am looking forward to doing it here",
"price": "50",
"productType": "digital",
"comparePrice": 0,
"inventory": "20",
"costPerItem": 0,
"status": "draft",
"mainImageUrl": ""
}'
Last updated