Closed swright-eti closed 1 year ago
I have figured out how to get around this, and I figured out why its happening. The reason it's happening is that our APIs returns either application/hal+json
or application/problem+json
. OpenBlocks doesn't know about those types.
The way to get around it is to use a transformer that does this:
return JSON.parse(get_device_list.data)._embedded.devices;
Hi @swright-eti ,
Bravo, looks like you're on the right track to write code and debug 😄 .
One more thing to notice, always remember to use the data browser on the left pane to check the types of your data:
Data shown in the result dialogue can be hard to tell whether it's a literal string or a JSON array/map.
"Data shown in the result dialogue can be hard to tell whether it's a literal string or a JSON array/map."
Good to know, thank you.
I am trying to create a module that contains a table that shows the result of a call to a REST API. The API returns data in the structure shown below. From the query I only want to return the
_embedded.devices
list. When I try to access it in a Javascript handler like thisconsole.log(get_device_list.data.embedded);
it shows as undefined.