Get Price
cURL
curl --request GET \
--url https://prod01-apigw.yourcompany.fabric.zone/api-price/price \
--header 'x-api-key: <x-api-key>' \
--header 'x-site-context: <x-site-context>'
Python
import requests
url = "https://prod01-apigw.yourcompany.fabric.zone/api-price/price"
headers = {
"x-site-context": "<x-site-context>",
"x-api-key": "<x-api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)
JavaScript
const options = {
method: 'GET',
headers: {'x-site-context': '<x-site-context>', 'x-api-key': '<x-api-key>'}
};
fetch('https://prod01-apigw.yourcompany.fabric.zone/api-price/price', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [\
CURLOPT_URL => "https://prod01-apigw.yourcompany.fabric.zone/api-price/price",\
CURLOPT_RETURNTRANSFER => true,\
CURLOPT_ENCODING => "",\
CURLOPT_MAXREDIRS => 10,\
CURLOPT_TIMEOUT => 30,\
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
CURLOPT_CUSTOMREQUEST => "GET",\
CURLOPT_HTTPHEADER => [\
"x-api-key: <x-api-key>",\
"x-site-context: <x-site-context>"\
],\
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
Go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://prod01-apigw.yourcompany.fabric.zone/api-price/price"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-site-context", "<x-site-context>")
req.Header.Add("x-api-key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Unirest
HttpResponse<String> response = Unirest.get("https://prod01-apigw.yourcompany.fabric.zone/api-price/price")
.header("x-site-context", "<x-site-context>")
.header("x-api-key", "<x-api-key>")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://prod01-apigw.yourcompany.fabric.zone/api-price/price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-site-context"] = '<x-site-context>'
request["x-api-key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body
Response Codes
- 200: Successfully retrieves price details.
- 400: SKU cannot be empty.
- 500: An internal error occurred. If the issue persists please contact support@fabric.inc.
Query Parameters
- limit (number): It limits the number of records returned by the API, default is
10 if not specified.
- offset (number): Number of records you wish to skip before selecting records. Default is
0 if not specified.
Headers
- x-site-context (string): Required. This header is a JSON object that contains information about the source you wish to pull from.
- x-api-key (string): Required. Enables access to fabric APIs without Authorization. Must be requested from fabric Inc.