GraphQL API configuration on Azure API gateway
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 09:14 AM
Does anyone have any idea on how to register the ServiceNow platform-provided graphQL API endpoint on the Azure API gateway?
I looking for some information on registering and fetching results on the Azure API gateway from the graphQL API endpoint.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 10:42 AM
Yes, it is possible to register the ServiceNow platform-provided GraphQL API endpoint on the Azure API gateway. Here are the steps you can follow:
Create an API Management instance in your Azure portal.
Create an API by going to the "APIs" tab and selecting "Add API". Provide a name, description, and the endpoint URL for your ServiceNow GraphQL API.
Next, create an operation in the API by selecting the "Add operation" button. Give it a name, and then set the URL template for the GraphQL query. The URL template should be in this format:/<graphql_endpoint>?query={query}&variables={variables}
Replace <graphql_endpoint> with the endpoint for your GraphQL API. This template allows the Azure API gateway to forward GraphQL queries to the ServiceNow platform.
Set the method for the operation to "POST".
In the "Policies" tab for the operation, add a policy that sets the HTTP header for the request. This header is required for ServiceNow's GraphQL API. Add this policy code:
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
Save the operation and publish the API.
Finally, test the API by sending a GraphQL query to the Azure API gateway. The query should be sent using a POST request, and the body should be in JSON format. Here's an example query:
{
"query": "{table {sys_id number}}"
}
Replace "table" with the name of a table in ServiceNow. This query fetches the sys_id and number fields for all records in the table.
That's it! You should now be able to register and fetch results from your ServiceNow platform-provided GraphQL API endpoint on the Azure API gateway.
Please mark my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2023 05:12 AM
Thanks for the detailed steps