Hello.
I’m trying integrated redash with API. But I got a problem with post data json to my API.

This is my query:

url: https://my_doamin/api/
method: post
json: “{\“query\”:\“query{ allAircraftTypes{ nodes{ id aircraftDescription description modelFullName } }}\”}”

And I got Error: Unexpected token " in JSON at position 0", “code”: 400, “type”: "entity.parse.failed.

Please help me.

The JSON data source uses YAML syntax. Not JSON. Rewrite your query as follows:

method: post
url: "https://my_doamin/api/"
json: 
  query: "query{ allAircraftTypes{ nodes{ id aircraftDescription description modelFullName } }}"

When executed, Redash will convert the json key to the following:

  {
    "query": "query{ allAircraftTypes{ nodes{ id aircraftDescription description modelFullName } }}", 
  }

Thank you very much.