Hey everyone,
I’m running into an issue while testing an SAP Gateway OData V2 service in Postman. The GET requests work perfectly, but when I try a POST request to create a record, I get this error:
“415 Unsupported Media Type
The content-type ‘application/json’ is not supported for this resource.”
Here’s what I’ve already tried:
-
Set both Content-Type and Accept headers to application/json
-
Also tested with application/atom+xml
-
Retrieved a valid CSRF token using a preliminary GET request
-
Verified my payload structure using the service’s $metadata endpoint
Despite this, the backend still rejects the POST request. From what I’ve read while studying SAP OData integration (and practicing with Pass4future exam scenarios), it seems this issue might be related to how the OData service interprets JSON payloads or specific headers required by the Gateway.
If anyone has experience testing SAP OData V2 endpoints in Postman, could you share what header setup or body format worked for you?
Thanks in advance!
Hey
That error is pretty common with SAP OData V2 services — it’s not a Postman issue but how the SAP Gateway expects the payload format.
By default, many OData V2 services in SAP don’t accept JSON for POST, PUT, or PATCH unless the service was explicitly configured to handle application/json. Most only accept Atom/XML format for write operations.
Here’s what you can try:
1. Use Atom/XML for POST
Set these headers:
Content-Type: application/atom+xml
Accept: application/atom+xml
x-csrf-token: <your valid token>
Then structure your body like this (example):
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<content type="application/xml">
<m:properties>
<d:CustomerID>10001</d:CustomerID>
<d:Name>John Doe</d:Name>
</m:properties>
</content>
</entry>
2. Check the Service’s Supported Formats
Run a GET on:
<your_service_url>/$metadata
and look for the m:HttpMethod="POST" sections — if it doesn’t list application/json, you’ll need to use XML.
3. Enable JSON (Optional, Developer-Side)
If you have access to the backend, your SAP developer can enable JSON for write operations by setting the proper format handling in the Model Provider Class or by adjusting the IWFND/MAINT_SERVICE configuration.
So in short:
415 Unsupported Media Type = your OData V2 service doesn’t accept JSON for that entity set.
Try using Atom/XML, and it should work fine.
1 Like