The LOCATE API is the key to unlocking all of the incredible features that LOCATE has to offer. After all, LOCATE is its API – everything you see in the LOCATE UI has been achieved using the exact same endpoints available to you here. When you’re looking to develop your own tools or UIs, the existing LOCATE UI can serve as your roadmap to the API, showing you how to navigate the API with expressways and side streets that make getting from A to B easier and more efficient!
When starting a new project, we recommend working through the process in the UI if possible. Naturally, your end result will likely differ if you are adding or removing steps to meet your clients’ needs, but it will give you a good starting point and will often reveal useful data via embeds or endpoints.
Here, we’ll look at a few common scenarios you may encounter and walk through how to break them down in the LOCATE UI.
Getting More Data From an Endpoint
A great way to start learning what data is accessible from a given endpoint is to see what embeds the UI uses when first calling a record. The easiest way to do this is to start from the Grid screen (or another order). Open your browser’s developer tools, click into the Network tab, clear the existing records if needed, then click into the desired object in LOCATE. The first request with the object’s ID is usually the best one to explore. This will have all the initial embeds needed to display the object’s information to the user.
Once you find the appropriate network call, you can look at the embed parameter to see what the UI has manually embedded:
You can also explore the response via the Preview tab, because there are some fields the API auto-embeds that might not be in the above list, like addresses:
Scenario: You have a list of Sales Orders and need to get information that is related to the order, like the name of the customer. While “customer name” isn’t a field you’d find directly on the sales order endpoint, but it is still accessible within the same request by embedding “customer” on the sales order.
Filtering for Unique Fields
Scenario: You need a list of parts, filtered by a custom field (Color: Blue).
The easiest way to see how this is done is to add the custom field to the Part grid in the UI and then filter for your desired value.
Note that when you submit a filter, it will need to be URL encoded in order to be interpreted/transmitted correctly.
Here’s an online tool that will encode your URL by turning
Working Through a Process
Scenario: You want to add a part to a group via the API
Working through the process in the Groups module of the UI will show you the endpoints needed to achieve this. Watch the requests made by the UI when the group is first loaded to see 2 key endpoints:
First, the group/nonmember endpoint returns all related objects not already in this group.
Second, the group/member endpoint lists all objects currently in this group.
Expanding the member response reveals that the dynamic “object_instance” embed will return the related member record (whether it is a part, customer, user, etc.)
Finally, add a new part to this group to see the POST that results in a new group member: