Hi Team,
I am new to outsystems, and I am trying to consume REST API in outsystems which providing the response as Text as below. How to convert the text to JSON. Tried with the JSON deserialize option but no luck. Getting the error as below.
https://abr.business.gov.au/json/AbnDetails.aspx?abn=30 613 501 612&guid={GUID}
Response: callback({"Abn":"30 613 501 612","AbnStatus":"Cancelled","AbnStatusEffectiveFrom":"2003-09-30","Acn":"","AddressDate":"2014-09-06","AddressPostcode":"6053","AddressState":"WA","BusinessName":[],"EntityName":"KADECO AUSTRALASIA PTY LTD","EntityTypeCode":"PRV","EntityTypeName":"Australian Private Company","Gst":null,"Message":""})
Attempted solution: After consuming the service response, used the JSONDeserialize and provided the above string to convert to JSON.
Created the structure entity with ABN,ABNStatus and etc..columns.
Error:OS-BERT-60600 - Failed to deserialize JSON to ABNResponseList: Unexpected character encountered while parsing value: c. Path '', line 0, position 0. outsystems
Hi Pranavi,
In OutSystems, when consuming a REST API, you define a method's input and output through Structures, and the Platform will convert to and from JSON automatically. You should almost never have to do a manual conversion.
That said, have you increased the logging level of the API and checked the Integration Logging in Sevice Center? This should give you the exact message that is sent by the API. If there's actually something like "callback(...)" around the JSON, that's one really funky API (though it's possible to do something about it). Do you have any documentation of the API that maybe describes this?
Mmm, looking here this is not a REST API, but some other service. I'm afraid in that case you'll need a On After Response to strip the "callback(...)" around the JSON, so the Platform can pretend it's a REST API.
@Kilian Hekhuis, you are right; they have limited JSON support as mentioned here: https://abr.business.gov.au/Tools/WebServices. @Pranavi Donthireddy , it's better to go with the SOAP-based service in this case.
Hello @Pranavi Donthireddy,
I would like to clarify that the web service endpoint requires prior registration to obtain a GUID.
The response provided indeed reflects this requirement.
To illustrate this, I have prepared an example that you can find below.
If you have any further questions or need additional assistance, feel free to ask!
Best regards,Rui