@Mahitha Pavuluri Thanks for reaching out to the Microsoft Q&A. Since you are able to access the API from the portal successfully and it is failing with 404 error only while accessing via the api gateway URL, You could leverage the tracing feature of the APIM to debug this.
Enabling the Trace Logs:
When making requests to API Management via your apim request url, using curl, or a REST client such as Postman, or a client app, You can enable tracing by adding the following request headers:
- Ocp-Apim-Trace - set value to
- Ocp-Apim-Subscription-Key - set value to the key for a tracing-enabled subscription that allows access to the API
The response includes the Ocp-Apim-Trace-Location header, with a URL to the location of the trace data in Azure blob storage.
Note: Ensure that the
Allow Tracing option is enabled for the subscription key for the Tracing to work.
More Information about debugging your API using request tracing is explained *here.
Analyzing the Trace Logs
1.* The logs will be in JSON format. You need to check the url field of the inbound and the backend section.
Ensure that the request urls are well formatted and routed correctly.
- You can refer to the status code field to check if the 404 was thrown by the APIM or backend service.
- Check if you have the correct API URL suffix added and you are calling the correct API while accessing the API from gateway url.
Feel free to get back to me if you need any assistance.
Please 'Accept as answer' so that it can help others in the community looking for help on similar topics.