### Request Body Examples Source: https://apidocs.plytix.com/v2/index Examples demonstrating how to structure request bodies for filtering, attribute selection, and pagination. ```APIDOC ## Request Body Examples ### Example 1: Filtering ```json { "filters":[ [ {"field":"modified","operator":"gt","value":"2018-11-01"}, {"field":"modified","operator":"lt","value":"2018-11-30"} ], [ {"field":"short_text","operator":"like","value":"unicorn"} ] ] } ``` ### Example 2: Attribute Selection ```json { "attributes":["sku", "label", "stock"] } ``` ### Example 3: Combined Filtering, Pagination, and Attributes ```json { "filters":[ [ {"field":"modified","operator":"gt","value":"2018-11-01"}, {"field":"modified","operator":"lt","value":"2018-11-30"} ], [ {"field":"short_text","operator":"like","value":"unicorn"} ] ], "pagination":{"order":"-sku","page":3,"page_size":25}}, "attributes":["modified", "stock", "description", "categories"] } ``` ``` -------------------------------- ### Simple Filter Example (JSON) Source: https://apidocs.plytix.com/v2/index Demonstrates a simple filter condition for searching products. This filter specifies a field, an operator, and a value to match. ```json { "field": "stock", "operator": "gt", "value": 10 } ``` -------------------------------- ### Compound Filter Example (JSON) Source: https://apidocs.plytix.com/v2/index Illustrates a compound filter, which is a list of simple filters treated as an AND condition. This example searches for products with stock greater than 10 and from a vendor containing 'ACME'. ```json [ {"field": "stock", "operator": "gt", "value": 10}, {"field": "vendor", "operator": "like", "value": "ACME"} ] ``` -------------------------------- ### Combined Filters, Pagination, and Attributes in Plytix V2 API Source: https://apidocs.plytix.com/v2/index An example combining filters, pagination settings (page number, items per page, sort order), and attribute selection for a comprehensive search query. ```json { "filters": [ [ {"field": "modified", "operator": "gt", "value": "2018-11-01"}, {"field": "modified", "operator": "lt", "value": "2018-11-30"} ], [ {"field": "short_text", "operator": "like", "value": "unicorn"} ] ], "pagination": {"order": "-sku", "page": 3, "page_size": 25}, "attributes": ["modified", "stock", "description", "categories"] } ``` -------------------------------- ### Complex Filter Example (JSON) Source: https://apidocs.plytix.com/v2/index Shows a complex filter structure combining AND and OR conditions. This example searches for products that meet either the first compound filter (stock > 10 AND vendor like 'ACME') OR the second compound filter (customer equals 'Wile E. Coyote'). ```json [ [ {"field": "stock", "operator": "gt", "value": 10} , {"field": "vendor", "operator": "like", "value": "ACME"}], [ {"field": "customer", "operator": "eq", "value": "Wile E. Coyote"} ] ] ``` -------------------------------- ### Products V2 BETA API Source: https://apidocs.plytix.com/v2/index This section details the endpoints for managing products using the V2 BETA API. Specific operations are detailed within the resource documentation. ```APIDOC ## Products V2 BETA ### Description This section provides documentation for the Products V2 BETA API endpoints. Refer to individual resource documentation for specific operations, parameters, and examples. ### Method GET, POST, PUT, DELETE (depending on the specific endpoint) ### Endpoint /products/v2 ### Parameters (Specific parameters will be detailed in the sub-sections for each product-related operation) ### Request Example (Refer to specific endpoint documentation) ### Response (Refer to specific endpoint documentation) ``` -------------------------------- ### Products API Source: https://apidocs.plytix.com/v2/index Endpoints for managing products, including creation, retrieval, updates, and deletion. Also supports operations on product variants, families, assets, categories, and relationships. ```APIDOC ## Products API ### Description Endpoints for managing products, including creation, retrieval, updates, and deletion. Also supports operations on product variants, families, assets, categories, and relationships. ### Endpoints #### POST /products **Description:** Creation of new products. #### GET /products/id **Description:** Operations on an specific product (retrieve). #### PATCH /products/id **Description:** Operations on an specific product (update). #### DELETE /products/id **Description:** Operations on an specific product (delete). #### GET /products/id/variants **Description:** List variants of a product. #### POST /products/id/variants **Description:** Creation of variants for a product. #### POST /products/id/variant/id **Description:** Operations on a specific variant (create). #### DELETE /products/id/variant/id **Description:** Operations on a specific variant (delete). #### POST /products/id/variants/resync **Description:** Resync variants attribute values. #### POST /products/id/family **Description:** Assign family to a product. #### GET /products/id/assets **Description:** Link of account assets to product (list). #### POST /products/id/assets **Description:** Link of account assets to product (create). #### GET /products/id/assets/id **Description:** Operations over linked assets (retrieve). #### DELETE /products/id/assets/id **Description:** Operations over linked assets (delete). #### GET /product/id/categories **Description:** Category assignment to product (list). #### POST /product/id/categories **Description:** Category assignment to product (create). #### GET /products/id/categories/id **Description:** Operations on a specific category (retrieve). #### DELETE /products/products/id/categories/id **Description:** Operations on a specific category (delete). #### POST /products/id/relationships/id **Description:** Add related products to current product. #### PATCH /products/id/relationships/id/unlink **Description:** Remove related products from current product. #### PATCH /products/id/relationships/id/products/id **Description:** Operations on related product. #### POST /products/search **Description:** Filter products by multiple criteria. ### Request Body for POST /products ```json { "field1": "string", "field2": "any" } ``` ### Success Response (200) for GET /products/id ```json { "id": "string", "name": "string", "description": "string" } ``` ``` -------------------------------- ### Product Families API Source: https://apidocs.plytix.com/v2/index Endpoints for managing product families, including creation, retrieval, updates, and attribute management. ```APIDOC ## Product Families API ### Description Endpoints for managing product families, including creation, retrieval, updates, and attribute management. ### Endpoints #### POST /product_families **Description:** Creation of new product families. #### GET /product_families/id **Description:** Operations on an specific product family (retrieve). #### PATCH /product_families/id **Description:** Operations on an specific product family (update). #### DELETE /product_families/id **Description:** Operations on an specific product family (delete). #### POST /product_families/search **Description:** Filter product families by multiple criteria. #### POST /product_families/id/attributes/link **Description:** Add new attributes to a family. #### POST /product_families/id/attributes/unlink **Description:** Removes attributes from a family. #### GET /product_families/id/attributes **Description:** Retrieves the product family attributes. #### GET /product_families/id/all_attributes **Description:** Retrieves the product family attributes including system attributes. ### Request Body for POST /product_families ```json { "name": "string", "description": "string" } ``` ### Success Response (200) for GET /product_families/id ```json { "id": "string", "name": "string", "description": "string" } ``` ``` -------------------------------- ### Authentication API Source: https://apidocs.plytix.com/v2/index Obtain an API token by sending a POST request with your API credentials to the authentication endpoint. Tokens are valid for 15 minutes. ```APIDOC ## POST /auth/api/get-token ### Description Obtain a Bearer Token for API authentication by providing your API key and password. ### Method POST ### Endpoint https://auth.plytix.com/auth/api/get-token ### Parameters #### Request Body - **apiKey** (string) - Required - Your Plytix API key. - **password** (string) - Required - Your Plytix API password. ### Request Example ```json { "apiKey": "YOUR_API_KEY", "password": "YOUR_API_PASSWORD" } ``` ### Response #### Success Response (200) - **token** (string) - The obtained Bearer Token. - **expires_in** (integer) - The token's validity period in seconds. #### Response Example ```json { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "expires_in": 900 } ``` ``` -------------------------------- ### Assets API Source: https://apidocs.plytix.com/v2/index Endpoints for managing assets (files) in your account, including uploading, querying, and deleting. ```APIDOC ## Assets This resource deals with the creation, deletion or query to assets (files) in your account. ### POST /assets Allows uploading of new assets to your account. ### GET /assets/id Operations on an specific asset (retrieve asset details). ### DELETE /assets/id Operations on an specific asset (delete asset). ### POST /assets/search Filter assets by multiple criteria. ``` -------------------------------- ### Custom Headers Source: https://apidocs.plytix.com/v2/index Provides information about custom headers used in API requests and responses. ```APIDOC ## Custom Headers ### Description Custom headers provide extra information in the API response. ### Response Headers - **X-Plytix-Deprecation** (String): This header is sent in the response when the used endpoint is going to be deprecated soon. ### Request Headers - **AUTHORIZATION** (String): Bearer Token. Format: `Bearer {{vault:authorization-secret}}`. ``` -------------------------------- ### Request Headers for Plytix API V1 Source: https://apidocs.plytix.com/v2/index Standard headers required for all requests to the Plytix API V1. These include Content-Type, Accept, and Authorization for authentication. ```text Content-Type: application/json Accept: application/json Authorization: Bearer {{your_token_value}} ``` -------------------------------- ### Pagination Source: https://apidocs.plytix.com/v2/index Controls how search results are returned, allowing specification of page number, items per page, and sorting order. ```APIDOC ## Pagination ### Description Controls how search results are returned, allowing specification of page number, items per page, and sorting order. The first page is returned by default. ### Parameters - **page** (Integer): The page number to retrieve. - **page_size** (Integer): The number of items to return per page. - **order** (String): Sort order of the elements. Format: `[+/-][ATTRIBUTE]`. Default is ascending. A '-' prefix indicates descending order. `[ATTRIBUTE]` refers to the column label. ``` -------------------------------- ### Successful Responses Source: https://apidocs.plytix.com/v2/index Explains the structure of successful API responses, which are always wrapped in a '_result_' object containing 'data', 'pagination' (for search operations), and 'attributes'. ```APIDOC ## Successful Responses Successful responses from the API are always wrapped in a `_result_` object. A `_result_` object is composed of: * `data`: List of items returned from the API. * `pagination`: Only in search operations. * `attributes`: When necessary, we must supply the column we want to be returned from API. When an operation returns no data, an empty list will be returned. ### Example: No Result Response ```json { "data": [] } ``` ### Example: Single Result Response ```json { "data": [ { "file_size": 30358, "file_type": "TEXTS", "filename": "example.pdf", "id": "123456789012345678901234", "thumb": "https://static.plytix.com/static/pim/img/filetypes/filetype_pdf.png", "url": "https://files.plytix.com/api/v1.1/file/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/texts/28/c9/fa/5b/5bfac92851e7590001486762/example.pdf" } ] } ``` ### Example: Multiple Result Response ```json { "data": [ { "filename": "blue_mug.png", "id": "5bfac7d851e7590001486761", "thumbnail": "https://files.plytix.com/api/v1.1/thumb/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d8/c7/fa/5b/5bfac7d851e7590001486761/blue_mug.png", "url": "https://files.plytix.com/api/v1.1/file/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d8/c7/fa/5b/5bfac7d851e7590001486761/blue_mug.png" }, { "filename": "blue_mug_big.jpeg", "id": "5bfaced551e7590001486763", "thumbnail": "https://files.plytix.com/api/v1.1/thumb/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d5/ce/fa/5b/5bfaced551e7590001486763/blue_mug_big.jpeg", "url": "https://files.plytix.com/api/v1.1/file/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d5/ce/fa/5b/5bfaced551e7590001486763/blue_mug_big.jpeg" } ] } ``` ``` -------------------------------- ### Categories API Source: https://apidocs.plytix.com/v2/index Endpoints for managing categories for assets and products, including adding, updating, and filtering. ```APIDOC ## Categories ### Assets #### POST /categories/file Add new asset category. #### POST /categories/file/id Operations on subcategories of category id (e.g., add subcategory). #### PATCH /categories/file/id Operations on subcategories of category id (e.g., update subcategory). #### DELETE /categories/file/id Operations on subcategories of category id (e.g., delete subcategory). #### POST /categories/file/search Filter asset categories by multiple criteria. ### Products #### POST /categories/product Add new product category. #### POST /categories/product/id Operations on subcategories of category id (e.g., add subcategory). #### PATCH /categories/product/id Operations on subcategories of category id (e.g., update subcategory). #### DELETE /categories/product/id Operations on subcategories of category id (e.g., delete subcategory). #### POST /categories/product/search Filter product categories by multiple criteria. ``` -------------------------------- ### Relationships API Source: https://apidocs.plytix.com/v2/index Endpoints for managing relationships between products, including creation and searching. ```APIDOC ## Relationships API ### Description Endpoints for managing relationships between products, including creation and searching. ### Endpoints #### POST /relationships **Description:** Creation of new relationships. #### GET /relationships/id **Description:** Operations on an specific relationship (retrieve). #### PATCH /relationships/id **Description:** Operations on an specific relationship (update). #### DELETE /relationships/id **Description:** Operations on an specific relationship (delete). #### POST /relationships/search **Description:** Filter relationships by multiple criteria. ### Request Body for POST /relationships ```json { "productId": "string", "relatedProductId": "string", "type": "string" } ``` ### Success Response (200) for GET /relationships/id ```json { "id": "string", "productId": "string", "relatedProductId": "string", "type": "string" } ``` ``` -------------------------------- ### General API Request Headers Source: https://apidocs.plytix.com/v2/index All requests to the Plytix API must include the following headers for content type, acceptance, and authorization. ```APIDOC ## General API Request Headers ### Description These headers are required for all requests to the Plytix API to ensure proper content negotiation and authentication. ### Headers - **Content-Type**: `application/json` - **Accept**: `application/json` - **Authorization**: `Bearer {{your_token_value}}` ### Example ``` Content-Type: application/json Accept: application/json Authorization: Bearer {{your_token_value}} ``` ``` -------------------------------- ### Attribute Selection in Plytix V2 API Source: https://apidocs.plytix.com/v2/index Shows how to specify desired attributes to be returned in search results. A limit of 20 attributes per search is enforced. For more attributes, consider retrieving product IDs first and then iterating. ```json { "attributes": ["sku", "label", "stock"] } ``` -------------------------------- ### Filters API Source: https://apidocs.plytix.com/v2/index Endpoints for retrieving available filter fields for assets, products, and relationships. ```APIDOC ## Available Filters ### GET /filters/asset Available asset fields. ### GET /filters/products Available product fields. ### GET /filters/relationships Available relationships fields. ``` -------------------------------- ### Filter Operators in Plytix V2 API Source: https://apidocs.plytix.com/v2/index Demonstrates the usage of standard filter operators like 'exists', '!exists', 'eq', '!eq', 'like', 'in', '!in', 'gt', 'gte', 'lt', 'lte', and 'text_search'. These operators allow for flexible data filtering based on various conditions. ```json { "filters": [ [ {"field": "modified", "operator": "gt", "value": "2018-11-01"}, {"field": "modified", "operator": "lt", "value": "2018-11-30"} ], [ {"field": "short_text", "operator": "like", "value": "unicorn"} ] ] } ``` -------------------------------- ### API Response: Multiple Assets Found (JSON) Source: https://apidocs.plytix.com/v2/index This JSON structure illustrates a successful API response containing multiple assets. The 'data' field is an array populated with several asset objects, each containing details like filename, ID, thumbnail URL, and the asset's direct URL. ```json { "data": [ { "filename": "blue_mug.png", "id": "5bfac7d851e7590001486761", "thumbnail": "https://files.plytix.com/api/v1.1/thumb/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d8/c7/fa/5b/5bfac7d851e7590001486761/blue_mug.png", "url": "https://files.plytix.com/api/v1.1/file/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d8/c7/fa/5b/5bfac7d851e7590001486761/blue_mug.png" }, { "filename": "blue_mug_big.jpeg", "id": "5bfaced551e7590001486763", "thumbnail": "https://files.plytix.com/api/v1.1/thumb/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d5/ce/fa/5b/5bfaced551e7590001486763/blue_mug_big.jpeg", "url": "https://files.plytix.com/api/v1.1/file/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d5/ce/fa/5b/5bfaced551e7590001486763/blue_mug_big.jpeg" } ] } ``` -------------------------------- ### Filtered Searches Source: https://apidocs.plytix.com/v2/index Provides advanced search capabilities across various resources using a flexible filter system. ```APIDOC ## Filtered Searches ### Description Advanced search is possible by means of the _search_ resource. Every search resource requires a set of conditions, columns to be retrieved, and pagination. ### Filter Conditions #### Simple Filter A _simple filter_ is defined by three fields: `field`, `operator`, and `value`. `field` and `operator` are mandatory. **Example:** ```json { "field": "stock", "operator": "gt", "value": 10 } ``` #### Compound Filter A _compound filter_ is a list of simple filters, treated as an AND condition. **Example:** ```json [ {"field": "stock", "operator": "gt", "value": 10}, {"field": "vendor", "operator": "like", "value": "ACME"} ] ``` #### Filter A _filter_ is a list of compound filters, where each item acts as an OR condition. **Example:** ```json [ [{"field": "stock", "operator": "gt", "value": 10}, {"field": "vendor", "operator": "like", "value": "ACME"}], [{"field": "customer", "operator": "eq", "value": "Wile E. Coyote"}] ] ``` ### Request Body for Search Endpoints (e.g., POST /products/search) ```json { "filter": [ [ {"field": "stock", "operator": "gt", "value": 10}, {"field": "vendor", "operator": "like", "value": "ACME"} ] ], "columns": ["id", "name", "stock"], "pagination": { "limit": 50, "offset": 0 } } ``` ### Common Operators - `eq`: equals - `neq`: not equals - `gt`: greater than - `gte`: greater than or equal to - `lt`: less than - `lte`: less than or equal to - `like`: string contains - `nlike`: string does not contain - `in`: value is in array - `nin`: value is not in array ``` -------------------------------- ### Error Handling Source: https://apidocs.plytix.com/v2/index Details the structure of error responses, which include a general error message ('msg') and an optional 'errors' array for specific field-level validation issues. ```APIDOC ## Handling Errors Whenever an operation fails, an `_error_` object is returned. An `error` object consists of: * `msg`: General error message. * `errors`: Optional array field containing detailed information of each error. * `field`: Offending column, field, etc. * `msg`: Detailed message, if any, of the error. ### Example: Simple Error Message ```json { "error": { "msg": "Missing Authorization Header" } } ``` ### Example: Detailed Error ```json { "error": { "msg": "product data validation failed", "errors": [ { "field": "some_non-existing_attribute_to_patch", "msg": "label does not exist" }, { "field": "some_decimal_number_attribute_to_patch_using_wrong_number_format", "msg": "Not a valid decimal value. Format must be: ." } ] } } ``` ``` -------------------------------- ### Standard Filter Operators Source: https://apidocs.plytix.com/v2/index Details common filter operators used for querying data. These operators can be applied to various fields, with some exceptions noted for specific filters. ```APIDOC ## Standard Filter Operators ### Description Common filter operators used for querying data. These operators can be applied to various fields, with some exceptions noted for specific filters. Some filters may have additional operators detailed in their respective sections. ### Operators - **exists** (Unary): Existence check. True when the item has its value defined. - **!exists** (Unary): Non-existence check. True when the item has its value undefined. - **eq** (Binary, value): Equality check. True if the item has the same value as the one provided. Case-insensitive for text values. - **!eq** (Binary, value): Inequality check. False if the item has the same value as the one provided. Case-insensitive for text values. - **like** (Binary, value): Contains check. True if the supplied string is contained within the item's value. - **in** (Binary, list): Match check. Determines if the item's value matches any of the values specified in the list. Case-sensitive for Multiselect and Dropdown attributes. - **!in** (Binary, list): Do not match check. Determines if the item's value does not match any of the values specified in the list. Case-sensitive for Multiselect and Dropdown attributes. - **gt** (Binary, value): Greater than. True if the item's value is greater than the provided value. - **gte** (Binary, value): Greater or equal than. True if the item's value is greater than or equal to the provided value. - **lt** (Binary, value): Less than. True if the item's value is less than the provided value. - **lte** (Binary, value): Less or equal than. True if the item's value is less than or equal to the provided value. - **text_search** (Binary, value): Text search. Allows searching for text within multiple items. The item list must be provided as the 'field' value. ``` -------------------------------- ### Attribute Selection Source: https://apidocs.plytix.com/v2/index Specifies which attributes to include in search results. By default, only a subset of attributes is returned. ```APIDOC ## Attribute Selection ### Description Specifies which attributes to include in search results. By default, only a small subset of attributes is returned. There is a limit of 20 attributes per search request. ### Parameters - **attributes** (Array of Strings): A list of attribute names to be included in the search results. ``` -------------------------------- ### API Response: No Data Found (JSON) Source: https://apidocs.plytix.com/v2/index This JSON structure represents an API response when no data is found for a query. It includes an empty 'data' array, indicating the absence of any returned items. This is a standard way to signify no results without returning an error. ```json { "data": [] } ``` -------------------------------- ### API Response: Single Asset Found (JSON) Source: https://apidocs.plytix.com/v2/index This JSON structure shows a successful API response containing a single asset. The 'data' field is an array that holds one object, detailing the properties of the requested asset, such as its file size, type, filename, ID, and thumbnail URL. ```json { "data": [ { "file_size": 30358, "file_type": "TEXTS", "filename": "example.pdf", "id": "123456789012345678901234", "thumb": "https://static.plytix.com/static/pim/img/filetypes/filetype_pdf.png", "url": "https://files.plytix.com/api/v1.1/file/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/texts/28/c9/fa/5b/5bfac92851e7590001486762/example.pdf" } ] } ``` -------------------------------- ### API Error Response: Simple Message (JSON) Source: https://apidocs.plytix.com/v2/index This JSON structure represents a basic API error response. It contains an 'error' object with a 'msg' field providing a general explanation of the failure, such as a missing authorization header. This format is used for straightforward error reporting. ```json { "error": { "msg": "Missing Authorization Header" } } ``` -------------------------------- ### API Error Response: Detailed Validation Failure (JSON) Source: https://apidocs.plytix.com/v2/index This JSON structure details an API error, specifically a product data validation failure. It includes a general 'msg' and an 'errors' array, where each object specifies the 'field' that caused the error and a detailed 'msg' explaining the validation issue, such as a non-existent attribute or an invalid number format. ```json { "error": { "msg": "product data validation failed", "errors": [ { "field": "some_non-existing_attribute_to_patch", "msg": "label does not exist" }, { "field": "some_decimal_number_attribute_to_patch_using_wrong_number_format", "msg": "Not a valid decimal value. Format must be: ." } ] } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.