i have published an endpoint in APIM- . when i test from the portal it gives 200 response but when i try to send the request to api gateway URL i get 404 resource not found error

Mahitha Pavuluri 0 Reputation points
2023-05-26T19:44:28.0533333+00:00

i have published an open AI service endpoint in APIM . when i test from the portal it gives 200 response but when i try to send the request to api gateway URL i get 404 resource not found error.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,206 questions
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 26,125 Reputation points Microsoft Employee
    2023-05-29T09:33:06.0366667+00:00

    @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 true
    • 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.
    User's image

    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.

    1. You can refer to the status code field to check if the 404 was thrown by the APIM or backend service.
    2. Check if you have the correct API URL suffix added and you are calling the correct API while accessing the API from gateway url.

    User's image

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.