-
Hello, I have an JSON endpoint that I am trying to hit that requires me to POST an auth_key. I can curl the information and get a proper response like this: My issue is whenever I try to put the auth_key in any of the the available locations in the plugin it comes out NULL on the other end. Locations I have put the auth_key into: Datasource -> Custom HTTP Headers Panel -> I have implemented these endpoints with fetch requests in JavaScript without any issues so I know my endpoints are solid. I have tried all these options but I keep getting a NULL value on the other side. (data logged in Python script) Thanks for supporting the community, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
That should indeed work. If none of those places work, it sounds like the value could actually be NULL/empty? Are you getting the value from a variable? Are you able to add any other values? |
Beta Was this translation helpful? Give feedback.
-
I was able to resolve this issues once I started posting the data to https://httpbin.org/post to get a better idea of how the data was being formatted. The main issue for me was that the POST data was being send in [args] rather than [form]: How I wanted the data: The key to getting the data into form was to set the Content-Type in the data source headers to application/x-www-form-urlencoded. Once I did that I was able to put the bob=dog value into the "Method and Body" under the "HTTP method, Query param, Headers" option inside the actual query panel. Hopefully this helps someone else who runs into this issue! |
Beta Was this translation helpful? Give feedback.
-
I have a similar situation. I am not even able to add the API as a data source ussing Grafana JSON API This the way it works with curl: Regards |
Beta Was this translation helpful? Give feedback.
I was able to resolve this issues once I started posting the data to https://httpbin.org/post to get a better idea of how the data was being formatted.
The main issue for me was that the POST data was being send in [args] rather than [form]:
{
"args": { "bob": "dog" },
"data": "",
"files": {},
"form": {},
"headers": {
"Accept": "application/json, text/plain, /",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.5",
"Content-Length": "0",
"Content-Type": "application/json",
"Host": "httpbin.org",
"User-Agent": "Grafana/8.3.3",
"X-Amzn-Trace-Id": "Root=12345",
"X-Grafana-Org-Id": "1"
},
"json": null,
"origin": "ip.addresses",
"url": "https://httpbin.org/post?bob=dog"
}
Ho…