Get order
cURL
curl --request GET \
--url https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/orderNumber/{orderId} \
--header 'x-site-context: <x-site-context>'
Python
import requests
url = "https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/orderNumber/{orderId}"
headers = {"x-site-context": "<x-site-context>"}
response = requests.get(url, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {method: 'GET', headers: {'x-site-context': '<x-site-context>'}};
fetch('https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/orderNumber/{orderId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/orderNumber/{orderId}",
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-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-order/orders/orderNumber/{orderId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-site-context", "<x-site-context>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Java (Unirest)
HttpResponse<String> response = Unirest.get("https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/orderNumber/{orderId}")
.header("x-site-context", "<x-site-context>")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/orderNumber/{orderId}")
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>'
response = http.request(request)
puts response.read_body
Response Codes:
- 200: Success
- 400: Bad Request
- 403: Forbidden
- 404: Not Found
- 500: Internal Server Error
Example Response
{
"order": {
"_id": "6021f6b8bd6ce10008579e8e",
"cartId": "5e4876e10cfe1d8902005d33",
"orderTotal": 125.33,
"taxTotal": 5.23,
"orderCurrency": "USD",
"status": "ORDER_CANCELLED",
"customerEmail": "ino@fabric.inc",
"items": [
{
"title": "abcDNA Luminous Cushion Lagoon",
"quantity": 1,
"price": 4.5,
"total": 4.54
}
]
}
}
Error Responses
{
"code": "ORDER_NOT_FOUND",
"message": "Order ID Not Found"
}
Headers
- x-api-key: Required for authentication.
- x-site-context: Required for pulling the relevant context.