Aligni’s GraphQL API uses the GraphiQL tool to provide the reference documentation, API browsing, and real time query and mutation processing. It’s an excellent way to engage the API in our demo environment or in your production environment to test out queries and explore the API documentation.
The Explorer for the Demo environment is available at the following URL – https://demo.aligni.org/api/v3/graphiql.
You can visit your organization’s live GraphiQL Explorer organization at the following URL:
https://ORGANIZATION-URL.aligni.com/api/v3/graphiql
Warning
The Production environment Explorer works with live data that belongs to your organization. Any changes made to your data will be reflected in Aligni. Use the Production environment Explorer with care.
Explorer User Interface
By default, the Explorer user interface is divided into 3 vertical areas:
- On the left, there is a narrow vertical main menu with options for Docs, History, and Explorer.
- In the center is a large editor for writing queries and mutations.
- On the right, GraphiQL will display responses after running queries.
Click on the top “Docs” icon to reveal a fourth vertical section that’s used for browsing the reference documentation (queries and mutations):
For example, if you want to see what parameters are supported for listing contacts, click on “Query” and then scroll down until you find “contacts” and click on the link:
Searching Reference Documentation
A faster way to find specific reference documentation is to use the built in search. If you visit the main page, there is a search link in the top right of the reference documentation browser:
Running Queries
The easiest way to run a query is to use GraphiQL Explorer. You can start the GraphiQL Explorer by clicking on the third icon from the top in the main menu (folder) – “Show GraphiQL Explorer”:
To list all parts you can then click on the “parts” query, then “nodes” and select which fields you want to display. For example, select “id”, “partNumber” and “manufacturerPn”.
You will see that the Explorer automatically generates the query in the editor:
Pressing the “play” button will run the query and show results:
Running Mutations
The easiest way to run a mutation is to use GraphiQL Explorer. You can start the GraphiQL Explorer by clicking on the third icon from the top in the main menu (folder) – “Show GraphiQL Explorer”. Then, scroll to the bottom of the page, until you see the control for adding a new query or a mutation. Select “Mutation” from the select box and click on the “+” button:
You will then see the list of all available mutations in the Explorer:
You can then select the mutation that you want and fields to automatically generate the mutation.
Keyboard Shortcuts
To see the list of available shortcuts, click on the second to last icon in the main menu – “Open short keys dialog”: