Trouble with payload in apoc.load.jsonParams

Hey guys,

Pretty new here and having problems making an API call in the neo4j browser:

with 'https://api.domo.com/xxxxxxx' as url call apoc.load.jsonParams(url,{Authorization:"Bearer xxxx"}, '{ "sql": "SELECT * FROM table" }') YIELD value as df return df

I get an error response that says "Server returned HTTP response code: 400" among other things indicating that domo feels the request is malformed. I can run the same request through Postman and everything seems fine and I can make a similar request successfully in neo4j. I couldn't find any examples using Google where somebody passed a payload. A search in this forum turned up only one. I modified my request to match the example:

with 'https://api.domo.com/xxxxxxx' as url call apoc.load.jsonParams(url,{Authorization:"Bearer xxxx", Method:"Post"}, apoc.convert.toJson({sql: "SELECT * FROM table" })) YIELD value as df return df

but still get a 400 error. I'm out of options...any ideas?

Hallelujah, I finally figured it out:

with 'https://api.domo.com/xxxxxxx' as url call apoc.load.jsonParams(url,{`Content-Type`:"application/json", Authorization:"Bearer xxxx", Method:"Post"}, apoc.convert.toJson({sql: "SELECT * FROM table" })) YIELD value as df return df

I had forgotten the Content-Type in the header.

2 Likes