Skip to Content

oData Service error message Unsupported Media Type Code 415 in post method

Dear Friend!

Good morning, How are you ?

while using Post method for oData Service : /sap/opu/odata/SAP/ZCRM_SERVICES_SRV/create_bp_prospectSet I am receiving error with status code 415. the error is unsupported media type.

1, I have attached Gateway Client Error message.

2. Payload.

3. EntitySet strucutre.

I have tried multiple ways but not successful. what I have tried are:

1. change typy to entry from feed : but it results in bad request with error code 400

2. I have put " " in all the fields, and numbers , also without it... but it results in status code 415 only.

3. I have debug the process as well and found that token was missing and some connection issues but all the get methods are working perfectly fine.

Please help me to understand where I am making mistake and How to solve this error. I will greatly appreicate your help in this matter

Best Regards

Naim

PayLoad

http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d=" http://schemas.microsoft.com/ado/2007/08/dataservices"> Syncronik Construction Services "ZCO01" 7.000 "m3" 2019-01-01T00:00:01 2019-12-31T23:00:00 "1" km xxx.xxx@syncronik.com xxxxxx "Z421" "560155" Monterrey "06" MX XXXX XXXX "1234567890" XXXXXX XXXX "0987654321"

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Nov 05, 2019 at 11:22 PM

    Look at the CORE_SAMPLES in the SAP Gateway Client.

    https://blogs.sap.com/2013/06/21/demo-test-cases/

    Doing a POST request on

    /sap/opu/odata/IWBEP/TEA_TEST_APPLICATION/Drafts

    and payload (see belows) works.

    Header:

    Content-Type application/atom+xml;type=entry; charset=utf-8

    Looking at your payload the <entry …> tag seems to be missing.

    If you perform a single read, use the "use as request" button and then change the URL so that it points to the entity set you are able to create appropriate payloads.

    Best Regards,

    Andre

    <?xml version="1.0" encoding="utf-8"?>
    
    <entry xml:base="https://ldai1g1y.wdf.sap.corp:44356/sap/opu/odata/IWBEP/TEA_TEST_APPLICATION/" 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">
    
     <id>https://ldai1g1y.wdf.sap.corp:44356/sap/opu/odata/IWBEP/TEA_TEST_APPLICATION/Drafts('1')</id>
    
     <title type="text">Drafts('1')</title>
    
     <updated>2019-11-05T23:14:32Z</updated>
    
     <category term="com.sap.TEA.TestApplication.Draft" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
    
     <link href="Drafts('1')" rel="edit" title="Draft"/>
    
     <content type="application/xml">
    
      <m:properties>
    
       <d:Id>1</d:Id>
    
       <d:price>-170.59</d:price>
    
       <d:currency>EUR</d:currency>
    
       <d:amount>1.1235</d:amount>
    
       <d:unit>KG</d:unit>
    
       <d:test_currency>XXX</d:test_currency>
    
       <d:test_unit>XX</d:test_unit>
    
       <d:test_id>abcd</d:test_id>
    
      </m:properties>
    
     </content>
    
    </entry>
    
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 06, 2019 at 10:17 PM

    Hello Mr Fischer.

    Thank you so much for your answer... it helped me alot. I appreciate your help greatly!

    Best Regards

    Naim

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.