#Get Product API.

The following endpoint allows merchant to get product from their Fatora Platform account.

https://api.fatora.io/v1/products/{product_id}
curl --location --request GET 'https://api.fatora.io/v1/products/{product_id}' \
--header "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjcyOTEyLTpyYW1pcmVzc2xhbkBnbWFpbC5jb20iLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9oYXNoIjoiOTExM2Y2OWEtMTYzMi00Nzg2LWE4NTctYmEzNWQ5YmEwMDc0IiwibmJmIjoxNzE5OTI0NDkzLCJleHAiOjE3NTEwMjg0OTMsImlhdCI6MTcxOTkyNDQ5M30.-rP1DT8LKk5jvBT_PpvaqFuUf_H6FhFiqAq9FM-34cw" \
--header 'Content-Type: application/json' \
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.fatora.io/v1/products/{product_id}',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjcyOTEyLTpyYW1pcmVzc2xhbkBnbWFpbC5jb20iLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9oYXNoIjoiOTExM2Y2OWEtMTYzMi00Nzg2LWE4NTctYmEzNWQ5YmEwMDc0IiwibmJmIjoxNzE5OTI0NDkzLCJleHAiOjE3NTEwMjg0OTMsImlhdCI6MTcxOTkyNDQ5M30.-rP1DT8LKk5jvBT_PpvaqFuUf_H6FhFiqAq9FM-34cw',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
// Define the API endpoint URL.
string apiUrl = "https://api.fatora.io/v1/products/{product_id}";

// Create a WebRequest.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiUrl);

// Set the request method to GET.
request.Method = "GET";

request.AddHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjcyOTEyLTpyYW1pcmVzc2xhbkBnbWFpbC5jb20iLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9oYXNoIjoiOTExM2Y2OWEtMTYzMi00Nzg2LWE4NTctYmEzNWQ5YmEwMDc0IiwibmJmIjoxNzE5OTI0NDkzLCJleHAiOjE3NTEwMjg0OTMsImlhdCI6MTcxOTkyNDQ5M30.-rP1DT8LKk5jvBT_PpvaqFuUf_H6FhFiqAq9FM-34cw");

// Set the request content type.
request.ContentType = "application/json";

try
{
    // Get the response.
    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
    {
        if (response.StatusCode == HttpStatusCode.OK)
        {
            // Read the response data.
            using (var responseStream = response.GetResponseStream())
            using (var reader = new StreamReader(responseStream))
            {
                string responseContent = reader.ReadToEnd();
                Console.WriteLine("API Response: " + responseContent);
            }
        }
        else
        {
            Console.WriteLine("API Request failed with status code: " + response.StatusCode);
        }
    }
}
catch (WebException ex)
{
    Console.WriteLine("API Request failed with an exception: " + ex.Message);
}
{
    "status": "SUCCESS",
    "product": {
        "id": 123,
        "name": "Sample Item",
        "price": 19.99,
        "sku": "SKU123",
        "image": "https://example.com/sample-image.jpg",
        "description": "This is a sample item description.",
        "creation_date": "2023-09-30T12:00:00",
        "currency": "QAR",
        "category": ["Category1", "Category2"],
        "qr_code": "https://api.qrserver.com/v1/create-qr-code/?data=sampleQRcode&size=50x50",
        "link": "https://example.com/sample-link",
        "status": "Active",
        "language": "en",
        "setting": {
            "is_public": true,
            "is_limited": false,
            "is_casheir": true,
            "max_count": 100,
            "max_order": 10
        }
    }
}

Try it now: Get Product API

Header Parameters

Header Value
Authorization: Bearer bearer_token REQUIRED obtain the bearer token from the Authorize endpoin. Read more information about Authentication.
Content-Type REQUIRED application/json

Query Parameters

Parameter Description
product_id REQUIRED intUnique identifier of the product to retrieved.

Response

HTTP Status Code: 200 OK - The product information has been successfully retrieved.

Response Schema: application/json
status string the status of response.
SUCCESS
product object:
  • id: int the id of product
  • name: string the full name of product
  • sku: string the SKU of product
  • price: decimal the price of product
  • image: string the image URL of product
  • description: string the description of product
  • creation_date: date the creation date of product
  • currency: string the currency of product
  • category: string categories of product
  • qr_code: string the QR code URL of product
  • link: string the link URL of product
  • status: string the status of product
  • language: string the language of product
  • setting: object the settings of the product:
    • is_public: bool Indicates whether the product should be displayed in the store or not.
    • is_limited: bool Indicates whether the product has a limited quantity.
    • is_casheir: bool Indicates whether the product will be displayed in the cashier interface or not.
    • max_count: decimal Indicates the maximum available quantity of the product in the store.
    • max_order: int indicates the maximum quantity that a customer can purchase of this product.

Otherwise if there was a problem with your request, you'll receive an error response such as 400 status code, and the response will include an error object describing why this request failed.

Response Schema: application/json
status string The status of response.
error object:
  • error_code string, the naumber of error: e.g: 400, For more information
    see Response Code
  • description string, the description of error: e.g: bad request
technical-support

🛠️ Technical Support