The shift from specific <object>ById queries to more generalized <object> queries with a where clause for ID filtering marks an significative change in the Sage Active Public API V2.
This new approach streamlines the querying process and aligns with the overall GraphQL philosophy.
Notes:
If you have already been using a query with a where clause to filter by ID for retrieving a record, you won’t need to make any changes.
This method remains effective and in line with the updated querying approach.
The latest version of the Postman collection has transitioned from using ById queries to filtered by Id for more streamlined and efficient data retrieval.
This update aligns with the current best practices in API querying.
Reduces the number of <object> types needed for list retrieval and individual record fetching, eliminating the need for a separate <object>ById object.
Enhances consistency with GraphQL’s general logic.
Improves performance, as <object> filtered by Id queries are faster than <object>ById.
Introduces a unified response format using edges and node, enhancing data consistency.
Previously, responses varied between the specific ById format and other query structures.
Now, all responses follow the same pattern, simplifying data parsing and handling across different queries.
This unified format aligns better with the typical GraphQL response structure, making it more intuitive for developers.
Recommendation
Since <object>ById queries have been removed, using the new ID-filtered queries is necessary to maintain functionality and ensure future compatibility.
Example: Transitioning from accountingAccountById to ID-Filtered Query
When transitioning from ById to filtered by Id queries, be aware of the change in the ID parameter’s expected type.
Queries that previously accepted ($id: ID!) now require ($id: UUID!).
This change indicates that the API expects a UUID format for unique identifiers, which is more specific and standardized than the generic ID type.
Exceptions
Since specific <object>ById queries have been removed and replaced by generalized <object> queries with an ID filter in the Sage Active Public API V2, this change applies universally without exceptions.
Actions Related to the ID of an Object
Certain actions are intrinsically linked to the ID of a specific object.
For example, ProductPrice only offers the productPriceById query. API resources overview / ⚙️Product Price service
These actions are tailored to operate uniquely with individual IDs and do not conform to the generalized list query format.
As such, they remain as standalone queries, ensuring precise and direct access to the specific data needed for these unique actions.