Fetch a Product With ID

GET /products/{id}

Use this endpoint to retrieve details of a particular product as per the id.

Header

                    
                        Authorization
                        Example: Bearer {YOUR_AUTH_KEY}
                        Content-Type
                        Example: application/json
                        Accept
                        Example: application/json
                    
                

URL Parameters

Parameter Datatype Description
id integer(required) This is a product id

Response Parameters

Parameter Datatype Description
id integer The unique identifier of the product.
name string The name of the product.
image string (URL) The URL of the product image.
sku string The SKU of the product and this also a unique identifier of the product.
hsn_code string The HSN code of the product.
description string The description of the product.
price_per_unit double Price of the per unit product.
maximum_retail_price double MRP of the product.
weight double Per unit weight of the product.
vol double Per unit volume of the product.
gst_percent double GST percentage of the product.
measurementtype collection Collection of product measurement type.
measurementtype.id integer The unique identifier of the product measurement type.
measurementtype.name string The name of the product measurement type.
productcategory collection Collection of product categories.
productcategory.id integer The unique identifier of the product category.
productcategory.name string The name of the product category.
productcategory.image string (URL) The URL of the product category image.
productpricings collection Collection of product pricings.
productpricings.id integer Unique identifier or id of the product pricing or pricing set. Product pricings are pricing sets setup for specific buying quantities of the same product. Example - Tata Tea Gold is the product and Pack of 12, Pack of 18 or Pack of 24 are 3 product pricing sets of the product.
productpricings.product_id integer ID of the product.
productpricings.buying_qty integer Product Pricings are basically selling prices for a specific set of quantity or pricing set. Here buying_qty refers to the qty against the pricing set .
productpricings.price double Selling price of the specific product pricing or pricing set against the specific buying quantity .

Sample Request

                    
                        curl --location 'https://webservices.sourcehub.in/api/product/17' \
--header 'Authorization: Bearer  *************'
                    
                

Sample Success Response

                    
                        {
                            "data": {
                                "id": 17,
                                "name": "XRin soap 185 Gm Mrp 10 (60pcs)",
                                "image": "https://sourcehub.in/public/images/product/1605344094.jpg",
                                "sku": "SH000021",
                                "hsn_code": "3401",
                                "description": '',
                                "price_per_unit": 10,
                                "maximum_retail_price": 600,
                                "weight": 11100,
                                "vol": 0,
                                "gst_percent": 18,
                                "measurementtype": {
                                    "id": 7,
                                    "name": "Cases"
                                },
                                "productcategory": {
                                    "id": 2,
                                    "name": "Detergents",
                                    "image": "https://sourcehub.in/public/images/productcategory/1668153151.png"
                                },
                                "productpricings": [
                                    {
                                        "id": 227,
                                        "product_id": 17,
                                        "buying_qty": 1,
                                        "price": 545
                                    },
                                    {
                                        "id": 228,
                                        "product_id": 17,
                                        "buying_qty": 5,
                                        "price": 2720
                                    },
                                    {
                                        "id": 229,
                                        "product_id": 17,
                                        "buying_qty": 10,
                                        "price": 5438
                                    },
                                    {
                                        "id": 230,
                                        "product_id": 17,
                                        "buying_qty": 25,
                                        "price": 13250
                                    },
                                    {
                                        "id": 625,
                                        "product_id": 17,
                                        "buying_qty": 30,
                                        "price": 16200
                                    }
                                ]
                            }
                        }
                    
                

Sample 401 Faliure Response

                    
                        {
                            "error": {
                                "code": "AUTHENTICATION_ERROR",
                                "description": "Invalid credential or token.",
                                "source": "https://webservices.sourcehub.in/api/product/17",
                                "status_code": 401
                            }
                        }
                    
                

Sample 404 Faliure Response

                    
                        {
                            "error": {
                                "code": "BAD_REQUEST_ERROR",
                                "description": "The id provided does not exist.",
                                "source": "https://webservices.sourcehub.in/api/product/17580",
                                "status_code": 404
                            }
                        }
                    
                

Errors

1. The API key/secret provided is invalid. Error Status: 401

The API credentials passed in the API call differ from the ones generated on the Dashboard. Possible reasons are:

  • Different keys for test mode and live modes.
  • Expired API key.

Solution :
The API keys must be active and entered correctly with no whitespace before or after the keys.

2. The ID provided does not exist. Error Status: 404

The ID does not exist or does not belong to the requestor.

Solution : Ensure that you use a valid ID that belongs to the requestor.

3. ID is not a valid ID. Error Status: 404

The ID passed is invalid.

Solution : Use a valid ID.

CONTENTS