Prerequisites for using API Key authenticated GraphQL I/O Doc
To successfully test the API Key authenticated GraphQL API on the Developer Portal > I/O Doc section, ensure you have completed the following setup on Cloud API Management (Control Center):
-
Created an API definition with a resource endpoint configured as a GraphQL endpoint:
You must create an API definition with a resource endpoint, and configure it as a GraphQL endpoint on Control Center.
-
Configured Key & Method Detection:
You must configure the following authentication fields on the Key & Method Detection page:
-
Request Authentication Type: Select API Key
-
Developer's API Key Location: Select Header, Parameters, or Path
-
Key Field Identifier: Specifies how the Traffic Manager identifies the API key in the request, depending on the Developer's API Key Location.
-
If Developer's API Key Location is set to Header or Parameters, enter
api_keyas the name of the key field. -
If Developer's API Key Location is set to Path, enter a number that represents the position of the API key in the public endpoint path.
noteThe value entered in this field determines the public endpoint path value on the Domains & Traffic Routing page.
-
Based on these settings, the location where the API key is sent in the request differs depending on the key location selected - Header, Parameters, or Path. Refer to the API Key Authenticated GraphQL I/O Doc Usage Reference for details on each combination.
-
-
(Conditional) Configured Domains & Traffic Routing:
You must configure the public domain address and endpoint path on the Domains & Traffic Routing page only when the Developer's API Key Location is set to Path on the Key & Method Detection page.
-
In the Customize your Public Endpoint Address first text box, enter your public domain address, and in the second text box, enter
303/{api_key}as the public endpoint path. Here{api_key}is a placeholder at the position matching the Key Field Identifier value set on the Key & Method Detection page.For example, if your Key Field Identifier is set to
1on the Key & Method Detection page, then the Traffic Manager reads the API key from the first path segment after the base path. -
In the Your Endpoint Address first text box, enter your backend domain address, and in the second text box, enter the endpoint path.
-
-
Configured endpoint CORS settings:
You must configure the following CORS fields to enable browser-based requests on the Endpoint Cross-Origin Resource Sharing page:
- Enable CORS: Enable this toggle switch.
- Allow CORS Requests from any domain: Enable this toggle switch.
- Sub-domain matching allowed?: Enable this toggle switch.
- List of headers allowed: Provide
api_key,content-type - Are cookies allowed?: By default, this is disabled. Keep it disabled.
-
Created a GraphQL I/O Doc and provided access to it:
You must have created a GraphQL Interactive Documentation item on the Control Center Interactive Documentation page and provided access to it on the API Definition Interactive Documentation Access Control page.
-
Created API Package, Plan, and Application:
-
You must have created an API Package, added an API Plan, and linked your GraphQL API definition and GraphQL endpoint to a plan on the Control Center.
-
You must have obtained your application's API key from the Developer Portal. Sign in, click My Account > My Applications, find your registered application, and click View Keys. This API key will be used for testing the GraphQL I/O Doc.
-
Next Steps
Once setup is complete, test your GraphQL API on the Developer Portal using your application's API key. Refer to Leveraging your GraphQL API Interactive Documentation.