Best practices

Best practices

Use these practices to build reliable and maintainable integrations with Sales Layer REST APIs.

Use metadata endpoints

Catalog metadata endpoints describe available fields, resource structures, and relationships.

Use metadata before building dynamic requests, especially when working with products, variants, categories, attribute sets, or custom entities.

Recommended metadata endpoints include:

GET https://api2.saleslayer.com/catalog/$metadata
GET https://api2.saleslayer.com/catalog/Products/$metadata
GET https://api2.saleslayer.com/catalog/Categories/$metadata
GET https://api2.saleslayer.com/catalog/Variants/$metadata

Cache metadata responses when possible, and refresh them when the account configuration changes.

Minimize response payloads

Use $select to request only the fields needed by the integration.

This reduces transfer size, speeds up processing, and makes logs easier to inspect.

GET https://api2.saleslayer.com/catalog/Products?$select=prod_ref,prod_title

Filter before processing

Use $filter to reduce the amount of data returned by the API.

Filtering at the API level is usually more efficient than retrieving a broad dataset and filtering it client-side.

Use pagination for large datasets

Use pagination for list operations.

For large Catalog datasets, prefer token-based pagination with $skipToken when the endpoint supports it and returns continuation links.

For DAM and endpoints that use offset-style pagination, use $top and $skip.

Respect rate limits

Design clients to stay below documented rate limits and retry temporary failures with bounded backoff.

Protect credentials

API keys must be treated as secrets.

Do not expose them in browser code, public repositories, screenshots, logs, or customer-facing error messages.

Handle responses intentionally

Use HTTP status codes to drive client behavior:

Build observable integrations

Log enough information to troubleshoot safely:

Do not log full API keys or sensitive payload values.