11
Views
4
Comments
[ardoJSON] Google Books API integration
ardojson
Service icon
Forge asset by João Barata
Hi there, i'm using the ardoJSON extention to integrate the google books api but i'm having some problems.
This is the link that generate the JSon content to transform in a record list on Outystems Platform:

https://www.googleapis.com/books/v1/volumes?q=harry+potter&maxResults=1

T
he follow error occurs on service center:

Message:
Unable to cast object of type 'Newtonsoft.Json.Linq.JArray' to type 'Newtonsoft.Json.Linq.JObject'.
Stack:
at OutSystems.NssardoJSON.CssardoJSON.readSimpleValue(JToken json, Type fieldType)
at OutSystems.NssardoJSON.CssardoJSON.readRecord(JObject json, Object rec)
at OutSystems.NssardoJSON.CssardoJSON.MssJSON2RecordList(String ssJSON, Object ssRecordList)
at ssBookify_Amazon_WS.RssExtensionardoJSON.MssJSON2RecordList(HeContext heContext, String inParamJSON, Object inParamRecordList)

 

If anyone knows why let me know.
Thank u
Best Regards
Miguel Grilo
2014-02-13 10-06-38
Ricardo Silva
Hi Miguel,

It seems like the error stems from a structural mismatch between JSON and the OutSystems structure (it's expecting an array because it has a record list and getting an object).

[EDIT] Actually, in this case it's the other way around. It's getting a JSON array when it's expecting an object (because on the structure it was defined as Record)

Can you provide us with the eSpace you're trying to consume this API ?
2018-07-16 13-30-04
Miguel Grilo
Hi Ricardo thanks for the fast reply
There's the OML that consume the API, only have test pages and nothing else.

Cheers
Miguel Grilo
Bookify_Amazon_WS_v94.oml
2014-02-13 10-06-38
Ricardo Silva
I made the following changes and could make it work with that JSON:

Wrapper Structure: change items type from Record to Record List
VolumeInfo Structure: change authors type from Record of authors to Record List of Text

Let me know if that also works for you.
2018-07-16 13-30-04
Miguel Grilo
Thanks Ricardo i've tested and works fine to!

Best Regards 
Miguel Grilo
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.