Product Update

Getting Started

Introduction

Product Update is used to update product details, used in price drop/inventory alert for sending price drop and inventory alert notifications. If you are using price drop or inventory alert feature then use this API to send the product price and inventory details to notify about the updated details.

Updating Product Details

Request URL

https://api.pushengage.com/apiv1/products
Method

POST
Request Parameters

Parameter Name Parameter Type Description
products Array Array of products to be update.
products.$.product_id String Product id used in alert.
products.$.price Number Updated price of the product.
products.$.availability String Availability (inStock/outOfStock ) of the product, if the product is available then inStock and if the product is not available then outOfStock . Default is inStock.
products.$.variant_id String Optional. Product variant id only required if you are using variant id while adding alerts.

Example

{
    "products": [
        // product 1 details
        {
            "product_id": "1",
            "price": 60,
            "availability": "outOfStock"
        },
          // product 2 details
        {
            "product_id": "2",
            "price": 100,
            "availability": "inStock",
            "variant_id": "variantId2"
        },
        .......
        ..........
    ]
}
Response Objects

Property Name Property Type Description
success Boolean Indicates whether product update request succeeded or not. Value can be 'true' or 'false'.

Example

Request

curl -X POST \
  https://api.pushengage.com/apiv1/products \
  -H 'Content-Type: application/json' \
  -H 'api_key: <your_pushengage_api_key>' \
  -d '{
    "products": [
        {
            "product_id": "1",
            "price": 100,
            "availability": "outOfStock",
            "variant_id": "variantID"
        },
        {
            "product_id": "2",
            "price": 100,
            "availability": "inStock",
            "variant_id": "variantId2"
        }
    ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pushengage.com/apiv1/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 => "{\n    \"products\": [\n        {\n            \"product_id\": \"1\",\n            \"price\": 100,\n            \"availability\": \"outOfStock\",\n            \"variant_id\": \"variantID\"\n        },\n        {\n            \"product_id\": \"2\",\n            \"price\": 100,\n            \"availability\": \"inStock\",\n            \"variant_id\": \"variantId2\"\n        }\n    ]\n}",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json",
    "Postman-Token: aa1dd380-32b0-4ee0-b052-ed7f3f385f71,6fb7f41c-a257-4742-b198-d1073b271671",
    "api_key: 0M14oj4S9F3UmZAY2KeHvlPrT1IX8bB5",
    "cache-control: no-cache,no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>

Response

{
  "success": true,
}
{
    "success": false,
    "error_code": "1001",
    "message": "Invalid API Key"
}
{
  "success": false,
  "error": {
        "name": "InvalidRequestException",
        "message": "Error Message"
    }
}