Skip to main content

When i execute a Post with one entry in an array, I get a 415 error (Unsupported Media).  When I execute a Post with one entry but not part of an array, it works fine.  When I post either of them on the destination site, they both work fine.  Is it possible that something in the dll is not quite right with regard to Posts of arrays?  The JSON in question is

[{"email":"default.eml.address@defaulteml.com","first_name":"WALTER","last_name":"M","company":"905 AUTO","street_1":"1160 CRESTLAWN DR UNIT#10","street_2":"SUITE 2008","city":"MISSISSUAGA","state":"ON","zip":" ","country":"CA","country_iso2":"CA","phone":"416454-9026","notes":" ","tax_exempt_category":"N","customer_groupid":0,"store_credit_amounts":[{"amount":500.00}]}] 

When i execute a Post with one entry in an array, I get a 415 error (Unsupported Media).  When I execute a Post with one entry but not part of an array, it works fine.  When I post either of them on the destination site, they both work fine.  Is it possible that something in the dll is not quite right with regard to Posts of arrays?  The JSON in question is

[{"email":"default.eml.address@defaulteml.com","first_name":"WALTER","last_name":"M","company":"905 AUTO","street_1":"1160 CRESTLAWN DR UNIT#10","street_2":"SUITE 2008","city":"MISSISSUAGA","state":"ON","zip":" ","country":"CA","country_iso2":"CA","phone":"416454-9026","notes":" ","tax_exempt_category":"N","customer_groupid":0,"store_credit_amounts":[{"amount":500.00}]}] 

I can't reproduce the issue with your JSON and RMNET. Have you tried executing a POST using another program (not COBOL) to see if it works there? Or even executing the POST to a different server to see if the issue is with the server?

"The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsupported format.

The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly." - https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/415

Did you set the content type correctly in the POST request in RMNET?


I can't reproduce the issue with your JSON and RMNET. Have you tried executing a POST using another program (not COBOL) to see if it works there? Or even executing the POST to a different server to see if the issue is with the server?

"The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsupported format.

The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly." - https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/415

Did you set the content type correctly in the POST request in RMNET?

Thanks for replying.  And yes, I have tried many different avenues, including the endpoint's developer site.  And they all work.  That makes me think it is the header Content-Type, but I am in debug when the HTTP Post command is issued and the Content Type is clearly application/json.  I've also tried taking out the fields one by one in the payload, but i get all they way down to one field and it still gives me the 415.  Even not having a required field, which would give a different error, and i still get the 415.  So it really feels like something is messing up the headers along way so that by the time it gets to the endpoint, the application/json is garbled or something like that.  When i specify Accept and Content-Type on their developer server, it works fine. And i asked if they had a way to interrogate the headers coming in and they did not.

The other difference between this one (post customers) and the one i have working (post products) is that the endpoint only allows arrays for customers but allows non-array format for products.  So, the other possibility i thought of - and the reason for my question - is that RMNET is not handling arrays or single entry array the same way it handles non-array.  But it sounds like you passed my payload through RMNET and it was fine?

So, yes, in summary, every non-COBOL avenue i have tried works.


Thanks for replying.  And yes, I have tried many different avenues, including the endpoint's developer site.  And they all work.  That makes me think it is the header Content-Type, but I am in debug when the HTTP Post command is issued and the Content Type is clearly application/json.  I've also tried taking out the fields one by one in the payload, but i get all they way down to one field and it still gives me the 415.  Even not having a required field, which would give a different error, and i still get the 415.  So it really feels like something is messing up the headers along way so that by the time it gets to the endpoint, the application/json is garbled or something like that.  When i specify Accept and Content-Type on their developer server, it works fine. And i asked if they had a way to interrogate the headers coming in and they did not.

The other difference between this one (post customers) and the one i have working (post products) is that the endpoint only allows arrays for customers but allows non-array format for products.  So, the other possibility i thought of - and the reason for my question - is that RMNET is not handling arrays or single entry array the same way it handles non-array.  But it sounds like you passed my payload through RMNET and it was fine?

So, yes, in summary, every non-COBOL avenue i have tried works.

Yes I sent the JSON (from above) in a POST to a test server that just echoes the payload back and I got no error. You should create a support case and upload a sample project that reproduces the issue so that we can investigate further.

Thank you


Yes I sent the JSON (from above) in a POST to a test server that just echoes the payload back and I got no error. You should create a support case and upload a sample project that reproduces the issue so that we can investigate further.

Thank you

Thanks.  One last question, if I may...in the process of creating a support case, I used a program which displays the response information and got the following.  It says 'Content-Type: text/html' - do you know if this means the endpoint server received my call with this content type (which is clearly wrong) or is it saying the endpoint server requires it to be test/html?  thanks for your help!


Thanks.  One last question, if I may...in the process of creating a support case, I used a program which displays the response information and got the following.  It says 'Content-Type: text/html' - do you know if this means the endpoint server received my call with this content type (which is clearly wrong) or is it saying the endpoint server requires it to be test/html?  thanks for your help!

That’s the content type of the response from the server. If you look at the response payload you can see that it’s HTML format. 


That’s the content type of the response from the server. If you look at the response payload you can see that it’s HTML format. 

ah, ok, makes sense, i am still pretty new at this.  i will submit a support case with a self-contained program that generates the error.  thanks again!