How to setup json datasource using Authorization Bearer token

I am not able to connect to a restful api using the json data source

url: “{{dt}}
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6ImFwcCIsImV4cCI6MTU3MzcwOTE2OSwiZW1haWwiOiJhcHBAYXBhbHlhLmNvbSJ9.l5B4Bg_zMGV83Yiya2EhujXJSx5x4R7-aoq5FJ1rgO8”

I get back a response Error running query: Expecting value: line 1 column 1 (char 0)

Please advise how to configure json datasource using Additional HTTP Options

You can pass additional keys to modify various HTTP options:

  • method - the HTTP method to use (default: get )
  • headers - a dictionary of headers to send with the request
  • auth - basic authentication username/password (should be passed as an array: [username, password] )
  • params - a dictionary of query string parameters to add to the URL
  • data - a dictionary of values to use as request body
  • json - same as data except that it’s being converted to JSON

Thanks and Best regards

Hi @apalya :slightly_smiling_face:, there seems to be an issue with your query (with the quotes):

url: "{{dt}}"
  Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6ImFwcCIsImV4cCI6MTU3MzcwOTE2OSwiZW1haWwiOiJhcHBAYXBhbHlhLmNvbSJ9.l5B4Bg_zMGV83Yiya2EhujXJSx5x4R7-aoq5FJ1rgO8"

Notice also that it uses the YAML formatting, so some spaces in the header items may make a difference :slight_smile:

1 Like