Products
With the API, you can retrieve and manage a brand’s products listings. This section describes popular use cases.
For a full overview of product functionality please visit the API Reference
The following two methods are recommended for managing your products & inventory between LeafLink and your external system.
- Take advantage of webhook functionality. By using webhooks, you can listen for events on the products that are being added or changed in LeafLink.
- Webhooks will trigger in real-time when the product is created or modified, eliminating the need to periodically check for changes.
- An alternative to using webhooks is to poll the /products/ API endpoint periodically using the modified date filter parameter (modified__gte, for example).
Create a product
To create a product, send a POST request to the /products/
endpoint with the product's details in the body of the request.
For examples and description of the available and required fields, please visit the Create a product
reference
We recommend following our Product Field Mapping Tips when creating products.
Integration Tip
If building an integration to push products into LeafLink, there are two scenarios you should account for.
Initial Bulk Import - Create all products that you wish to list on LeafLink.
Newly Created or Eligible Product Import - If a new product is created or an existing product now meets the requirements to list on LeafLink, the product should be created.
For both processes:
- Capture and store the id of the newly created product in your system. The product
id
will be required to update the product.
Update a product
To update an existing product, send a PATCH request to /products/{id}/
, where {id}
is the id for the product you wish to update, with the fields you wish to update in the body of the request.
For the full set of available fields and their definitions, please visit the Update a product
reference
The following request updates the description for the product created in the last section.
/**
PATCH /api/v2/products/303113/
Host: sandbox.leaflink.com
Authorization: App 54901b614b81d25084edc7b1f2016571b96778910d7b8b0befgf8decd418d6ab
Content-Type: application/json
*/
{
"description": "Our finest flower inspires and relaxes for a uniquely soothing experience."
}
Integration Tip
If a product has been updated in your external system prior to the last sync, update the product in LeafLink.
Archive a product
To archive a product, send a DELETE request to /products/{id}/
, where {id}
is the id for the product you wish to archive.
The following example archives the product that we updated in the previous section.
DELETE /api/v2/products/303113/
Host: sandbox.leaflink.com
Authorization: App 54901b614b81d25084edc7b1f2016571b96778910d7b8b0befgf8decd418d6ab
Content-Type: application/json
Integration Tip
Integrating an external system with LeafLink?
If the product has been deactivated or deleted from the external system, archive the product in LeafLink.