External API action JSON output in NodeJS

I have a GET on an API enpoint, the data reponse is fine in PAW/PostMan, but I am struggling with the JSON in Wappler

My reponse in PAW is

HTTP/1.1 200 OK
      "date": "Fri, 08 Jan 2021 14:10:18 GMT",
      "content-length": "576",
      "last-modified": "Fri, 08 Jan 2021 10:38:22 GMT",
      "content-type": "application/json",
      "connection": "Close"
{
  "$descriptor": “Test Account                              ",
  "$totalResults": 9,
  "$startIndex": 1,
  "$itemsPerPage": 1,
  "$resources": [
    {
      "$url": "http://192.168.1.54/accounts/{1}/Customer(103)",
      "$uuid": “103",
      "$httpStatus": "OK",
      "$descriptor": "",
      "name": “Test Record",
      "Balance": 640.0
    }
  ]
}

My response in Wappler is

{
“apiGetBalance”: {
“status”: 200,
“headers”: {
“date”: “Fri, 08 Jan 2021 14:10:18 GMT”,
“content-length”: “576”,
“last-modified”: “Fri, 08 Jan 2021 10:38:22 GMT”,
“content-type”: “application/json”,
“connection”: “Close”
},
“data”: "{\r\n “$descriptor”: "Test Account “,\r\n “$totalResults”: 9,\r\n “$startIndex”: 1,\r\n “$itemsPerPage”: 1,\r\n “$resources”: [\r\n {\r\n “$url”: “http://192.168.1.54/accounts/{1}/Customer(103)”,\r\n “$uuid”: “103”,\r\n “$httpStatus”: “OK”,\r\n “$descriptor”: “”,\r\n “name”: “Test Record”,\r\n “Balance”: 640.0\r\n }\r\n ]\r\n}”
}
}

Any suggestions would be appreciated.
Thanks

Fetch schema is correct

So exactly the same API action using ASP Classic Server Model works as expected.
But the above happens with Node.JS

@patrick @George @Teodor

Where did you get the json output with \r\n ?
In the fetch results from the node project ?

Can you output the data with apiGetBalance.data or you’re getting an error ?

If you get an error, can you try apiGetBalance.parseJson().data

It looks like the json is returned in plain text.
Best way to be sure is to output your apiGetBalance step and check in the dev tools (network tab). I think you need debug mode activated in wappler as well for this.

If you see an object, then everything works as expected. If you see a string, there is a glitch on your api side or on wappler’s one.

There are no errors. I just cannot bind data to the Wappler UI.

The output with \r\n is displayed when right clicking on the Wapper API Action and viewing in the browser or by inspecting the browser tools and network.

The exact same API Action viewing in the browser running under ASP Classic is fine, but the plain text \r\n is when the server model is Node.js

Hmm those \n\r are weird indeed. @patrick will check it out

1 Like

Thanks @George
Happy to PM you the API endpoint and credentials to test

Yes please do

Here an update for the api, unzip the file in lib/modules.

api.zip (1.2 KB)

1 Like

Fixed in Wappler 3.7.1

This topic was automatically closed after 46 hours. New replies are no longer allowed.