External catalogs

External catalogs are managed by your website. You must create API endpoint to enable the catalog.

Requests

Searching products is simply making POST request to your endpoint with the data needed to retrieve a list of products. A product may have variants that are fetched only if the user access them.

All requests are signed with the header 'X-Webhook-Signature' using the key you indicated in your GreenLeaze dashboard (signature is a base64-encoded HMAC-SHA256 of the exact stringified JSON request body). Some other header field may be added for legacy reason, please don't use them.

Product endpoint

POST Request with the following body

{
  "query": "search-query",
	"field": "value"
}

By default "field" isn't in the query, to improve search, it is possible to restraint the search on a specific field (name, sku,...) and let the user decide where to search in the UI. Contact GreenLeaze to enable this feature.

The request is waiting for the following response format :

[
  {
    title: string;
		id: string;
    combination: string | null;
    combinationId: string | null;
    priceTTC: number; // In euro, 3010.32 = 3010.32 €
    vat: number; // 20 for 20%
    hasVariants: boolean | n;
    image: string | null; // Direct image url, CORS accessible on *.greenleaze.com domains
    quantity: number | undefined; // Available quantity
    reference: string | undefined; 
    disabled: boolean | undefined;
  }
]

If "hasVariants" is true then the endpoint variant will be used to fetch variants if the user selects the product.

The "Reference" field may be shown to the dashboard's users to help them identify the correct product.

Variant endpoint

POST Request with the following body

{
  "query": "search-query",
	"productId": "product-id"
}

The request is waiting for the following response format :

[
  {
    title: string;
		id: string;
    combination: string | null;
    combinationId: string | null;
    priceTTC: number; // In euro, 3010.32 = 3010.32 €
    vat: number; // 20 for 20%
    image: string | null; // Direct image url, CORS accessible on *.greenleaze.com domains
    quantity: number | undefined; // Available quantity
    reference: string | undefined;
    disabled: boolean | undefined;
  }
]