GraphQL is a modern way of writing API queries that allow users to retrieve data based on query fields. This way the processing speed of the query is improved and retrieved data size is less compared to other alternatives like REST API calls.
Additional resources: GraphQL documentation
Contents
Create GraphQL imports
Important: Before you create an import from GraphQL you need to have a GraphQL connection available.
Start creating an import to your application using GraphQL in either of the following ways:
- From the Tools menu, select Flow builder. Then, click Add destination.
– or –
- From the Resources menu, select Imports. Then, click + Create import.
From the Application drop-down menu, select GraphQL and your available GraphQL connection.
Edit GraphQL import details
One to many (required): One to many is used when you have a single record that needs to create multiple records internally. You would use this setting if, for example, your parent record contains child records you need to process. This setting cannot be used when importing a CSV file.
How would you like the records imported?
HTTP method (required): Choose one of the following methods to import your records:
- Composite: makes changes depending on the existence or absence of records in the destination application. Composite requests require you to define how to create new records, identify existing records, and update existing records.
- DELETE: deletes records from the destination API based on your criteria.
- PATCH: sends the destination API instructions on how to modify existing records.
- POST: adds new records to the destination application.
- PUT: replaces existing records with new record data.
Consult your destination application's API documentation to determine which method is best to use for your import.
The Query field defines the request the GraphQL server is processing. If you use the query shorthand syntax (omitting the operation type and name), you can’t supply a name or any variable definitions for your operation. Note that the operation name is required if you’re writing a multi-operation query.
Building a GraphQL query is fairly straightforward once you understand the data schema and your application’s GraphQL endpoint API documentation. You can build a query during a connection, export, or import. Either way, the query structures stay the same.
The Operation name field is only required if your query has two or more operations. A request can only execute one operation at a time.
The operation name is a meaningful and explicit name for your operation. Its use is encouraged because it is helpful for debugging and server-side logging. When something goes wrong, such as errors in your network logs or in your GraphQL server logs, it's easier to identify a query in your codebase by name instead of deciphering the contents. Think of it as a function name in your favorite programming language.
The Variable field defines the JSON variables used in your query. For example, if the query is query HeroNameAndFriends($episode: Episode), define the variable as {"episode":"JEDI"}.
Non-standard API response patterns
Some APIs may have response patterns that are unusual when compared to most APIs. Use the settings below to accommodate outlying response codes.
Path to id field in HTTP response body: Use this field to tell integrator.io where in the HTTP response body to find the id field for the record submitted. This path field is relative to each individual record returned for batch requests. If this field is left blank, then integrator.io will automatically try to pick an id field for you.
Advanced
Data URI template: Use this field to tell integrator.io where in the HTTP response body to find the id field for the record submitted. For batch requests, this path field is relative to each individual record returned. If this field is left blank, then integrator.io will automatically try to pick an id field for you.
Preview & send
You can preview your import data to see the constructed request and a sample record that represents what integrator.io will send to the destination application.
Comments
0 comments
Please sign in to leave a comment.