Issue while trying to test API using OpenAPIGen tool

Not applicable

We generated an openAPI spec and were able to successfully import it onto the portal. However one observation is that, when we test the API in the run API tab, we are getting the response successfully. But when we try to run the same from the view docs tab, we are getting an error.

The scenario that we are trying is we have created a proxy to get access token using grant type password and using that access token, we are calling a back end service which will provide the response after validating it. When we run this in the run API tab, we are getting the response successfully. We also checked it in the trace in apigee edge. But when we try running it after the creation of the spec from the view docs tab, it is giving a 401 error.Can you please let us know what could be the possible reason? Have you faced or come across this before?

Solved Solved
0 3 164
1 ACCEPTED SOLUTION

@Shwetha R Yermal , Welcome to Apigee Community,

It's expected if API is not CORS enabled. "View Docs" tab is just for visualizing the API docs using swagger UI. It should not be used for making the API calls until unless API is CORS enabled. Same has been explained in step 8 here .

If you are Apigee Edge customer, If you need docs to explore / test APIs, please use Apigee Smartdocs in Apigee Developer Portal.

Hope it helps.

View solution in original post

3 REPLIES 3

@Shwetha R Yermal , Welcome to Apigee Community,

It's expected if API is not CORS enabled. "View Docs" tab is just for visualizing the API docs using swagger UI. It should not be used for making the API calls until unless API is CORS enabled. Same has been explained in step 8 here .

If you are Apigee Edge customer, If you need docs to explore / test APIs, please use Apigee Smartdocs in Apigee Developer Portal.

Hope it helps.

Thanks @Anil Sagar. That helped!

@Shwetha R Yermal, Glad it helped. You can also click on Accept link below the answer so that it will be helpful for others too.