Retrieving data from pages
Entities called on pages
Each page retrieves information via API from a single entity, which may be orders, endpoint_orders, containers or piece_groups. To find out which entity is called on which page, see the mapping below:
Body of the request
Body structure
For all pages, the API calls made are constructed as follows :
Filters - Enables filtering on the correct entities, so that the right data is displayed in the Store App of the stock location. In general, this will include at least the endpoint_id, the initial state and the destination state. But other fields can be added to filter further.
Fields - Enables requesting the necessary fields that will be used for the display.
Example of the pack page :
The API call is requested on the containers
entity. We filter to retrieve only the boxes
in the new
state, which can transit to the packed
state, from the endpoint
and the user
currently connected.
The fields requested are used for the display of the pack page. Fields at the root relate to the container
itself, but we can browse the structures to find for information in the piece_groups
, endpoint_orders
or the order
itself.
Default bodies
The bodies of the queries have been designed to filter exactly on the desired entities. To see the default configurations, unfold the banner below.
Fields overloading
99% of the time, query filters do not need to be overloaded. This is not the case for the requested fields. Quite often, the fields requested by default are incomplete and do not correspond exactly to your needs.
There are two ways of adding fields to your query:
My field is an item feature
It is very likely that you will need this field on several pages at once. This is why a general configuration of the Store App allows you to request additional item features on all pages. This configuration can be accessed from the Configuration > Store App > General settings backoffice page.
Once configured, these features will be automatically requested in the 'fields' structure of all pages.
My field is elsewhere than in the item
This field must be added page by page, in the Configuration > Store App > Pages > {Page name} > Additional fields configuration.
The path to request the right field is sometimes very complex and not very intuitive, so it is advisable to copy the paths already entered in the default configuration. (ex: to request the quantity of items in the pack page, the additional field must be "containers.box.piece_groups.order_item.quantity"
)
Entire body overloading
It is possible that the filters made in the request do not correspond exactly to your needs. In this case, it is possible to completely overload the requests.
To do this, you need to enter the new request body in the Configuration > Store App > Pages > {Page name} > Query overload page of the Backoffice.
Fully overloading a request is very complex and must be exceptional. This requires a thorough knowledge of our APIs, so please get in touch with your Onestock technical contact.
Check the response following modifications
Once you have modified the fields or the body of the query, it is important to check that this has worked before configuring display elements such as properties or filters.
To do this, open the console in the Store App, go to the ‘Network’ tab, filter on ‘Fetch/XHR’, and find the call corresponding to your page. Then:
Check the body sent to the API in the ‘Payload’ tab
Check the response received from the API in the ‘Preview’ tab
Example: I've added the ‘department’ feature to the ‘Request features’ configuration in the Store App. Before configuring the display, I check that my field is correctly requested, and that it is correctly received.
Payload
Response