Rest Api error

  

HI all.


I have problem with regarding Rest Api.

When i trying expose from other site error occured

The format of value '' is invalid.
   at System.Net.Http.Headers.HttpHeaderParser.ParseValue(String value, Object storeValue, Int32& index)
   at System.Net.Http.Headers.MediaTypeHeaderValue.Parse(String input)

when i debugged its not entered Rest Api Method

so, i assumed error occured on

      3. OnAuthentication() .

      4. Parameters Deserialization and Validation 

then, i copied cXML and using Postman sent it my rest api it went well. I am really confused now.

Some body help me where i go to wrong.

Thanks.

 Bat.





Hi Bat,

I'm having trouble deducing whether you consume a REST API or expose  a RES API. You are saying you try to "expose from other site", but the error seems to indicate you actually consume an external API.

I'm also confused why you mention "cXML". OutSystems REST APIs work with JSON only, you cannot consume a REST API that doesn't produce JSON (without resorting to "manually" parsing the XML).

hi Killian Hekhuis.

Thank you for reply.

I am consuming an external API.

I was earlier, consume with no probelm mock application

OrderAck.aspx

ORDERACK 's preparation action i expose to  API/rest/Supplier/DeliverInput

it was went no problem.

Now i changed directly to  "API/rest/Supplier/DeliverInput" then error is occured.

When i use Postman it went well.


Best Regards



Solution

Ok, so you are consuming an external REST API, and you at first tried to consume a mock version that you yourself created in OutSystems, am I understanding that correctly? Note that there's no single standard for how JSON from a REST API is formatted (other than that it must be valid JSON). It might well be that the REST consume now expects a different format than what it gets from the external API. Therefore, I would urge you to remove the REST consume from our eSpace, and re-consume the actual, external API, and try to consume that.

Solution

Thank you for reply.

So I assume working solution is Not using Rest API. Use webscreen i am correct ?

Atached png for better understand.


Best Regards

Hi Bazargur,

It's difficult to assess what kind of API you are facing, and whether it should be working with OutSystems, especially if you haven't tried to find out the root cause of the problem. I would advise you to do like I said, consume the external API directly (without trying mock-ups), and see whether you still have these errors. And even if you do have these errors, OutSystems allows you to inspect and modify the JSON that is sent to the Platform after receiving it, so there's quite a lot you can still do before giving up.