| title | Import SAP OData Metadata as an API | |
|---|---|---|
| titleSuffix | ||
| description | Learn how to import OData metadata from SAP as an API to Azure API Management, either directly or by converting the metadata to an OpenAPI specification. | |
| ms.service | azure-api-management | |
| ms.custom |
|
|
| author | martinpankraz | |
| ms.author | mapankra | |
| ms.topic | how-to | |
| ms.date | 03/16/2026 |
[!INCLUDE api-management-availability-all-tiers]
This article describes how to import an OData (Open Data Protocol) service into Azure API Management by using OData metadata. The following example uses SAP Gateway Foundation.
In this article, you learn how to:
[!div class="checklist"]
- Retrieve OData metadata from your SAP service
- Import OData metadata to Azure API Management, either directly or after converting it to an OpenAPI specification
- Complete API configuration
- Test the API in the Azure portal
-
Create an API Management instance.
-
An SAP system and service that's exposed as OData v2 or v4.
-
If your SAP backend uses a self-signed certificate (for testing), you might need to disable the verification of the trust chain for SSL. To do so, configure a backend in your API Management instance:
- In the Azure portal, under APIs, select Backends > + Create new backend.
- Add a Custom URL that points to the SAP backend service.
- Expand the Advanced section, then clear the Validate certificate chain and Validate certificate name checkboxes.
[!NOTE] In production scenarios, use proper certificates for end-to-end SSL verification.
Use one of the following methods to retrieve metadata XML from your SAP service. If you plan to convert the metadata XML to an OpenAPI specification, save the file locally.
- Use the SAP Gateway Client (transaction
/IWFND/GW_CLIENT). - Make a direct HTTP call to retrieve the XML:
http://<OData server URL>:<port>/<path>/$metadata.
[!INCLUDE api-management-navigate-to-instance]
Choose one of the following methods to import your API to API Management:
- Import the metadata XML as an OData API directly.
- Convert the metadata XML to an OpenAPI specification.
[!INCLUDE api-management-import-odata-metadata]
-
Use an OASIS open-source tool for OData v2 or OData v4, depending on your metadata XML.
The following example converts OData v2 XML for the test service
epm_ref_apps_prod_man_srv:odata-openapi -p --basePath '/sap/opu/odata/sap/epm_ref_apps_prod_man_srv' \ --scheme https --host <your IP address>:<your SSL port> \ ./epm_ref_apps_prod_man_srv.xml
[!NOTE]
- For testing with a single XML file, you can use a web-based converter that's based on an open-source tool.
- With the tool or the web-based converter, specifying the <IP address>:<port> of your SAP OData server is optional. Alternatively, add this information later in your generated OpenAPI specification or after you import the file to API Management.
-
Save the openapi-spec.json file locally for import to API Management.
-
In the sidebar menu, in the APIs section, select APIs.
-
Under Create from definition, select the OpenAPI tile:
:::image type="content" source="./media/import-api-from-oas/oas-api.png" alt-text="Screenshot that shows the OpenAPI tile.":::
-
Choose Select a file, and then select the openapi-spec.json file that you saved locally in a previous step.
-
Enter API settings. You can set these values when you import the API or configure them later by going to the Settings tab.
-
For the API URL suffix, we recommend using the same URL path as that of the original SAP service.
-
For more information about API settings, see Import and publish your first API tutorial.
-
-
Select Create.
Note
For information about API import limitations, see API import restrictions and known issues.
Add the following three operations to the API that you imported. To learn how, see Add and test an operation.
-
GET /$metadataOperation Description Additional configuration for the operation GET /$metadataEnables API Management to reach the $metadataendpoint, which is required for client integration with the OData server.
This required operation isn't included in the OpenAPI specification that you generated and imported.Add a 200 OKresponse.:::image type="content" source="media/sap-api/get-metadata-operation.png" alt-text="Screenshot that shows the GET metadata operation.":::
-
HEAD /Operation Description HEAD /Enables the client to exchange cross-site request forgery (CSRF) tokens with the SAP server when required.
SAP also allows CSRF token exchange via the GET verb.
CSRF token exchange isn’t covered in this article. See an example API Management policy snippet to broker token exchange.:::image type="content" source="media/sap-api/head-root-operation.png" alt-text="Screenshot that shows the operation for fetching tokens.":::
-
GET /Operation Description Additional configuration for the operation GET /Enables policy configuration at the service root. Configure the following inbound rewrite-uri policy to append a trailing slash to requests that are forwarded to the service root:
<rewrite-uri template="/" copy-unmatched-params="true" />
This policy removes potential ambiguity among requests with and without trailing slashes. These two types of requests are treated differently by some backends.:::image type="content" source="media/sap-api/get-root-operation.png" alt-text="Screenshot that shows the GET operation for the service root.":::
You also need to configure authentication to your backend by using an appropriate method for your environment. For examples, see Authentication and authorization.
-
Navigate to your API Management instance.
-
In the sidebar menu, select APIs > APIs.
-
Under All APIs, select your imported API.
-
Select the Test tab to access the test console.
-
Select an operation, enter any required values, and then select Send.
For example, test the
GET /$metadatacall to verify connectivity to the SAP backend. -
View the response. To troubleshoot, trace the call.
-
When you're done testing, exit the test console.
- See an example end-to-end scenario for integrating API Management with an SAP gateway.
- Control access to an SAP backend by using API Management policies. For example, if the API is imported as an OData API, use the validate OData request policy. There are also policy snippets for SAP principal propagation for SAP ECC or S/4HANA or SAP SuccessFactors and fetching an X-CSRF token.
- For guidance on deploying, managing, and migrating APIs at scale, see:
[!INCLUDE api-management-define-api-topics.md]