In my previous blog I have described how to create a GraphQL API in WSO2 API Manager. In this blog, I will be testing the same API using the WSO2 API Manager developer portal. To test the GraphQL API published in the WSO2 API Manager devportal, we first need to subscribe to the API through an application. You can reach the WSO2 API Manager devportal at https://localhost:9443/devportal and login using your credentials. Click on the subscribe button available in the overview page of the API.
It redirects to the subscription page where we need to create an application. I have created a sample application named SpaceX with unlimited throttling and access token type as JWT.
Once the application is created, the application is automatically subscribed to the SpaceXAPI by clicking on the next button. Here we can also choose the grant type to be used for token generation.
As we have restricted one of the operations of SpaceXAPI to adminScope scope previously, we will use the same scope to generate access token.
Once the access token is generated, copy the token and click on test button to navigate to Try Out console.
Once it opens the Try Out console, paste the copied access token in access token field.
The query is defined in the schema definition of GraphQL. GraphQL gives us the flexibility to query only the necessary attributes instead of querying all the attributes defined in the query schema definition.
To query the necessary data pass the payload inside query{}. By clicking on the execute button next to GraphQL, we get the json data.
So, in this blog you discovered how to test an API using the WSO2 API Manager developer portal. I hope this was useful. In case you have a question, or if you are in need of WSO2 Support, don’t hesitate to leave a comment below or contact us via our contact form.