Use field filtering to receive in the response only the data that is necessary. This allows to significantly speed up the response from the server and reduce the load on it.
To filter fields, use the params parameter.
The request example:
The methods by which you can apply filtering are those methods that return information about the object (when making an API request GET method is used). These methods end in “list”, “info” or “find” (eg order.list , product.info , etc.) You can see the list of available methods for a specific platform by using method cart.methods .
To get all the fields (attributes) that the platform supports in this method, the value force_all is used. It is specified in the params parameter. When using the value force_all , the list of other fields that need to be displayed can not be specified. They will be presented in the response. With force_all , the received fields of the first nesting level can be applied as filter names in the params parameter. Therefore, when displaying a list of required fields in the response, the params parameter values are the names of these fields, separated by commas.
Fields to which filtering can be applied can be divided into several groups:
General (unified) :
These fields are available on any platform. For example, for a product, it can be a name, description, price; for orders - status, delivery address, payment method. In some cases, when the platform does not support some common field for all platforms, “null” will be returned in the corresponding field.
Additional fields are only available on a specific platform. They may differ in name from the fields of another platform, or even be absent on it. For example, on Opencart there is a field "product_tag" , and on Bigcommerce there is "search_keywords" field.
Additional fields are obtained (filtered) in the same way as the main ones. In the request, they are returned in the "additional_fields" array:
To select (filter) additional fields in params , specify additional_fields and NECESSARILY a list of additional fields that need to be received.
To expand the functionality of a particular store, owners install plugins or add an array of standard fields for a particular platform. Accordingly, the list of these special fields will be absent for another store on this platform and even on the same version. Therefore, to take into account all changes in the data structure and obtain all data with changes, an individual approach is required.
Special fields are returned in the array "custom_fields" .
For selection (filtering) of special fields the same principle is used, as for additional. Only in this case the list of special fields does not need to be specified:
Additional parameter exclude
The additional parameter exclude is used in conjunction with the force_all parameter to exclude from the array all returned fields that are not required.