CreateNewProduct

This endpoint is there to create new product

POST https://sandbox.pgecom.com/api/v1/merchant/product

Headers

NameTypeDescription

Authorization*

String

Bearer {{token}}

Request Body

NameTypeDescription

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"
}

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);
});

Last updated