REST work fine testing in Service Studio, but throws 406 Not Acceptable at Runtime?

Hi, this has been puzzling me for a long time, and I actually had abandoned this would-be Forge component project.


Using Service Studio to test REST API, it works fine, but throws 406 Not Acceptable at Runtime.


This is quite similar to this REST API ServiceStudio vs Runtime issue here (but different error code):
https://www.outsystems.com/forums/forum_topicview.aspx?topicid=52914&topicname=rest-415-unsupported-media-type&


OML attached.


On Before Request added to log the entire Request Text.

It can be found in Service Center -> Monitoring -> General Logs


{"long_url":"https://www.outsystems.com/forums/discussion/52951/rest-work-fine-testing-in-service-studio-but-throws-406-not-acceptable-at-runtim/#Post197756","group_guid":"Bj39l6WcuhU"}


Request text looks right to me....

Then I debug OnBeforeRequest to check the headers.

Seem fine also.


Hi Harlin,

Why do you log the JSON to the General Log? It would seem easier to increase the logging level of the API, so you can check the Integration Logging.

Also, judging the bitly API documentation, you will be able to check the extended error information that it sends.

Solution

Yes, that wasn't the most efficient way.

Actually debugging is the fastest way to get RequestText.


Anyway, I've found the culprit...


By overwriting Content-Type header to just "application/json" at OnBeforeRequest, solve this error.

So, not every API like "application/json; charset=UTF-8" in Content-Type header.

ServiceStudio API testing use only "application/json" but Outsystems Runtime use "application/json; charset=UTF-8" in Content-Type header.


Shouldn't Outsystems internal guys need to be notified of this behaviour?

Solution

Hi Harlin,

They definitely should, so I will do just that :). Thanks for reporting back!

Hi everyone,

I would like to add I had a very similar issue which was reported in this post:
https://www.outsystems.com/forums/discussion/52914/rest-415-unsupported-media-type/


Just a heads up