Variants Overview
The Variants resource provides information about variants and their relationships with other entities, such as Products. Using the metadata and endpoints described here, you can query, filter, and navigate through variants data efficiently.
Metadata
The metadata is a JSON schema document that describes all resources within the Variants entity and their relationships to other entities. This metadata can be used to construct queries for the API and to understand the structure of related entities.
Key Details about Metadata
- When requesting metadata for a table, you also receive metadata for its related tables (e.g. Products, and Variants).
- The metadata is essential for understanding which fields can be queried and expanded.
[GET] Variants Metadata Endpoint
https://api2.saleslayer.com/rest/Catalog/Variants/$metadata
Making a request
To make a request to our API, you will need to use the appropriate method (GET), endpoint URL and include the API key in the request headers for authentication.
Receiving a response
When you make a request to our API, you will receive a response in the form of a JSON object. This object will contain the data requested, as well as any relevant metadata such as status codes and error messages.
{
"value": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "/metadata/9587/Variant/1.0.0.0",
"type": "object",
"title": "Variant",
"description": "Variant metadata definition",
"default": {
"culture": "en"
},
"properties": {
"frmt_stat": {
"title": "Status",
"type": [
"string",
"null"
],
"enum": [
"V",
"I",
"D",
"R"
],
"default": "R"
},
"prod_ref": {
"title": "var_prod_ref",
"type": [
"string",
"null"
]
},
"frmt_ref": {
"title": "Variant Reference",
"type": "string"
}
},
"required": [
"frmt_ref"
]
}
],
"readLink": {
"uri": "https://api2.saleslayer.com/rest/Catalog/Variants/$metadata"
}
}
Querying Variants
To retrieve category data, use the Variants endpoint with the desired parameters.
[GET] Variants Endpoint
https://api2.saleslayer.com/rest/Catalog/Variants
Making a request
$select
parameter. https://api2.saleslayer.com/rest/Catalog/Variants?$top=5&$select=frmt_ref
Receiving a response
When you make a request to our API, you will receive a response in the form of a JSON object. This object will contain the data requested, as well as any relevant metadata such as status codes and error messages.
{
"value": [
{
"frmt_ref": "F234940"
},
{
"frmt_ref": "F234941"
},
{
"frmt_ref": "F234943"
},
{
"frmt_ref": "F234943 2 - clone"
},
{
"frmt_ref": "F234944"
}
],
"@count": 80,
"@readLink": "https://api2.saleslayer.com/rest/Catalog/Variants?$top=5&$select=frmt_ref",
"@nextLink": "https://api2.saleslayer.com/rest/Catalog/Variants?$top=5&$select=frmt_ref&$skip=5"
}
[GET] Variants of a product Endpoint
https://api2.saleslayer.com/rest/Catalog/Products({productIdentifier})/Variants
Making a request
$select
parameter. https://api2.saleslayer.com/rest/Catalog/Products(3)/Variants?$select=prod_ref, frmt_ref
Receiving a response
When you make a request to our API, you will receive a response in the form of a JSON object. This object will contain the data requested, as well as any relevant metadata such as status codes and error messages.
{
"value": [
{
"prod": {
"reference": "42PH021300412"
},
"frmt_ref": "F234946"
},
{
"prod": {
"reference": "42PH021300412"
},
"frmt_ref": "F234952"
}
],
"@count": 2,
"@readLink": "https://api2.saleslayer.com/rest/Catalog/Products(3)/Variants?$select=prod_ref, frmt_ref"
}
[GET] A Variant resource Endpoint
https://api2.saleslayer.com/rest/Catalog/Variants({variantIdentifier})
Making a request
https://api2.saleslayer.com/rest/Catalog/Variants(4)?$select=frmt_ref
Receiving a response
Select the properties of the variant resources using the $select
parameter (is available in the JSON schema returned by the /Variants/$metadata endpoint) and get a response
{
"value": {
"frmt_ref": "F234943"
},
"@readLink": "https://api2.saleslayer.com/rest/Catalog/Variants(4)?$select=frmt_ref",
"@editLink": "https://api2.saleslayer.com/rest/Catalog/Variants(4)?$select=frmt_ref"
}
[GET] A variant resource associate to a product resource Endpoint
https://api2.saleslayer.com/rest/Catalog/Products({productIdentifier})/Variants({variantIdentifier})
Making a request
https://api2.saleslayer.com/rest/Catalog/Products(3)/Variants(48)?$select=frmt_ref,frmt_stat,prod_ref
Receiving a response
Select the properties of the variant resources using the $select
parameter (is available in the JSON schema returned by the /Variants/$metadata endpoint) and get a response
{
"value": {
"frmt_stat": "V",
"frmt_ref": "F234952",
"prod": {
"reference": "42PH021300412"
}
},
"@readLink": "https://api2.saleslayer.com/rest/Catalog/Products(3)/Variants(48)?$select=frmt_ref,frmt_stat,prod_ref",
"@editLink": "https://api2.saleslayer.com/rest/Catalog/Products(3)/Variants(48)?$select=frmt_ref,frmt_stat,prod_ref"
}