Get order by email - Fabric

Get order by email

cURL

curl --request GET \
  --url https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/user/guest \
  --header 'x-site-context: <x-site-context>'

Python

import requests

url = "https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/user/guest"

headers = {"x-site-context": "<x-site-context>"}

response = requests.get(url, headers=headers)

print(response.text)

JavaScript

const options = {method: 'GET', headers: {'x-site-context': '<x-site-context>'}};

fetch('https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/user/guest', 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-order/orders/user/guest",
  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/user/guest"

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))
}

Unirest

HttpResponse<String> response = Unirest.get("https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/user/guest")
  .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/user/guest")

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

Example Response

[
  {
    "_id": "60271eb8f69adb00083a80ac",
    "tags": "<array>",
    "cartId": "602710f862e75a0009ed25b7",
    "attributes": [
      {
        "price": 4,
        "_id": "60271baf8e1368000914bd0e",
        "attributeId": "60270ac95b4c090007cafde3",
        "value": true,
        "name": "Small Package Giftwrap",
        "type": "bool",
        "id": "60271baf8e1368000914bd0e"
      }
    ],
    "customerEmail": "abid@fabric.inc",
    "orderCurrency": "USD",
    "orderTotal": 8433,
    "taxTotal": 22,
    "channel": 12,
    "status": "ORDER_CREATED",
    "statusLog": "Order has been created",
    "orderReference": "6015-4453-86622",
    "orderId": "1461-8514-32344",
    "shipTo": [
      {
        "address": {
          "name": {
            "first": "Mike",
            "middle": "p",
            "last": "holard"
          },
          "phone": {
            "number": "998-992-9404",
            "kind": "Mobile"
          },
          "street1": "3520 Crowley Drive",
          "city": "Vancouver",
          "state": "BC",
          "country": "Canada",
          "zipCode": 98004,
          "kind": "shipping",
          "email": "mike@fabric.inc"
        },
        "promosApplied": "<array>",
        "_id": "60271c6d8d9f7a000852a107",
        "shipToType": "SHIP_TO_ADDRESS",
        "taxCode": "FR1000",
        "shipToId": 49,
        "price": 5,
        "currency": "USD",
        "shipmentMethodId": 10002,
        "estimatedTax": 2,
        "shipmentCarrier": "Fedex",
        "shipmentMethod": "Next Day",
        "total": 7,
        "id": "60271c6d8d9f7a000852a107"
      }
    ],
    "items": [
      {
        "group": [
          1.2312312312312322e+23
        ],
        "promosApplied": [
          {
            "unit": "10%OFF",
            "value": 16,
            "ON": {
              "kind": "SKU",
              "value": "<string>"
            },
            "id": "6023f20cb609010008c06af8",
            "promoId": "6023f20cb609010008c06af6"
          }
        ],
        "_id": "602710f862e75a0009ed25b8",
        "price": 8400,
        "weightUnit": "kg",
        "itemId": 1000000050,
        "quantity": 1,
        "priceListId": 100000,
        "sku": "WATCH123456",
        "taxCode": "PAC12345",
        "title": "Watch",
        "weight": 2,
        "lineItemId": 1,
        "attributeTotalPrice": 2,
        "attributes": [
          {
            "price": 2,
            "_id": "60271b3cfb9109000886b4a9",
            "attributeId": "602714e50e8f780007e66d97",
            "value": "Happy for you",
            "name": "Item Level free Text",
            "type": "string",
            "id": "60271b3cfb9109000886b4a9"
          }
        ],
        "currency": "USD",
        "shipToId": 49,
        "discount": 1600,
        "estimatedTax": 20,
        "total": 8420,
        "id": "602710f862e75a0009ed25b8"
      }
    ],
    "shipments": "<array>",
    "payments": [
      {
        "billToAddress": {
          "name": {
            "first": "Mike",
            "last": "holard"
          },
          "phone": {
            "number": 7780811973,
            "kind": "Mobile"
          },
          "email": "mike@fabric.inc",
          "street1": "345 67 Main Street",
          "street2": "tex",
          "city": "AUSTIN",
          "state": "TX",
          "country": "US",
          "zipCode": 1003
        },
        "shipToId": [
          49
        ],
        "_id": "60271eb8f69adb00083a80b1",
        "paymentIdentifier": {
          "cardIdentifier": 1111
        },
        "paymentMethod": "Visa",
        "paymentKind": "Fabric User",
        "amount": 8433,
        "currency": "USD",
        "conversion": 1,
        "paymentToken": {
          "token": 40059083049,
          "type": "CARD"
        },
        "id": "60271eb8f69adb00083a80b1"
      }
    ],
    "revision": 0,
    "totalQuantity": 1,
    "statusDescriptions": "<array>",
    "events": "<array>",
    "createdAt": "2021-02-13T00:35:04.240Z",
    "updatedAt": "2021-02-13T00:35:04.240Z",
    "__v": 0
  }
]

Error Responses

{
  "code": "<string>",
  "message": "<string>"
}
{
  "message": "Forbidden"
}
{
  "code": "<string>",
  "message": "<string>"
}

Headers

x-api-key

string

Example:

"0LybWR49k95cCwYh3cu0waCYoh4H2Eux2J52wn4k"

x-site-context

string required

The x-site-context header is a JSON object that contains information about the source you wish to pull from. The mandatory account is the 24 character identifier found in Copilot. The channel (Sales channel ID), stage (environment name), and date attributes can be used to further narrow the scope of your data source.

Example:

"{\"date\": \"2023-01-01T00:00:00.000Z\", \"channel\": 12, \"account\": \"1234abcd5678efgh9ijklmno\",\"stage\":\"production\"}"

Query Parameters

orderEmail

string

required

User email that we want to get orders for.

Example:

"johnsmith@gmail.com"

Response

200

application/json

Order

Attributes

_id

string

Example:

"60271eb8f69adb00083a80ac"

tags

array

cartId

string

Example:

"602710f862e75a0009ed25b7"

attributes

object[]

Show child attributes

customerEmail

string

Example:

"abid@fabric.inc"

orderCurrency

string

Example:

"USD"

orderTotal

number

Example:

8433

taxTotal

number

Example:

22

channel

number

Example:

12

status

string

Example:

"ORDER_CREATED"

statusLog

string

Example:

"Order has been created"

orderReference

string

Example:

"6015-4453-86622"

orderId

string

Example:

"1461-8514-32344"

shipTo

object[]

Show child attributes

items

object[]

Show child attributes

shipments

array

payments

object[]

Show child attributes

revision

number

Example:

0

totalQuantity

number

Example:

1

statusDescriptions

array

events

array

createdAt

string

Example:

"2021-02-13T00:35:04.240Z"

updatedAt

string

Example:

"2021-02-13T00:35:04.240Z"

__v

number

Example:

0