Please note that DTOs are no longer utilized for query operations in our GraphQL setup for Sage Active Public API V2.
This change simplifies the data retrieval process by directly referencing the actual resource names in fragments instead of using DTOs.
See more details below in the Queries chapter.
When working with GraphQL, specifically Hot Chocolate, in the context of Sage Active Public API V2, it’s essential to understand the role and naming convention of Data Transfer Objects (DTOs).
These DTOs facilitate data exchange between client and server and play a critical role in mutations.
General Naming Convention
For each resource, we use a specific naming pattern for the associated DTOs:
Create operations: CreateGLDtoInput
Update operations: UpdateGLDtoInput
Delete operations: DeleteGLDtoInput
For instance, for a resource named AccountingAccount:
Create: AccountingAccountCreateGLDtoInput
Update: AccountingAccountUpdateGLDtoInput
Delete: AccountingAccountDeleteGLDtoInput
The Role of DTOs in Mutations
Create Mutation Example
For creating a new resource, you will use the CreateGLDtoInput DTO. The following mutation creates a new Journal Type:
In our GraphQL setup for Sage Active Public API V2, DTOs are no longer used in query operations.
Instead, replace DTO references in fragments with the actual resource name to streamline data retrieval.
When defining fragments that previously relied on DTOs, you should now use the actual resource name.
The resource name in the fragment must be in singular form with the first letter capitalized.
For example:
For a resource named customers, the fragment should be on Customer.
For a resource named accountingEntries, the fragment should be on AccountingEntry.
Here’s how you should reference resources in your queries:
Query with Fragment Example
The following query retrieves a list of users along with specific user properties defined in a fragment:
REMOVEDThis feature has been removed and will cause a compatibility break if it was previously in use. Fragment: UserProps on UserGLDto