Query REST API with JSON Plugin

I have a group in a game called “Planetside 2”. It has an API, and I would like to integrate it with grafana. I have tried to query it with 2 plugins (JSON, SimpleJson), and whenever I use SimpleJson it says “Expected response data to be array, got object.”

The API that I use is here : http://census.daybreakgames.com/get/ps2:v2/outfit/?alias=FN28&c:resolve=member_character_name

The plugins you listed requires you to host a custom backend. The API you’re using don’t implement the endpoints required by those plugins, which is why you’re getting errors.

However, I published a plugin today that might be helpful to you. It uses JSON Path to extract data from a JSON API.

Unfortunately, I tried the API you’re using and realized that the plugin doesn’t support query parameters at this point. I’ll try to see if I can figure that out.

Works without query parameters though:

Thank you! I’m new to grafana, and this type of graphing.

Now I am having this error: r is undefined

@marcusolsson
Is there any way to accept parameters like ?alias=FN28
I’ve been trying to get this to work for 15 minutes now.

Yes, sorry for the confusion. I had to add support for query variables for this to work. I’ve just published v0.2.0 that adds support for this. Can you update the plugin and try again?

Sure, no problem. I’ll update it.

1 Like

Thank you! It works! :sweat_smile:

Awesome! :tada: If you have any more feature requests, or bug reports, please feel free to submit an issue to the GitHub project.

1 Like

@marcusolsson, is there a way to use dashboard variables in the “custom query paramaters” while setting up the datasouce for Json API ?

This is supported in later versions. You can now override query params in the query editor.

@marcusolsson , i have installed the latest version 0.8.0 from the web-site. When i try to configure the JSON datasource in Grafana an error appears:
" An unexpected error happened
Details:
Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

in Unknown
in div
in t
in form
in div
in div
in t
in div
in div
in div
in t
in t
in div
in t
in t
in x
in ConnectWithCleanUp(Connect(t))
in r
in Unknown
in t
in Unknown
in h
in Unknown
in Unknown
in t
in t
in l

" … do you have any clue what is wrong?

The “Minified React error” usually means that you’re attempting to load a plugin in an unsupported Grafana version. The recent versions of JSON API require at least Grafana 7.3. Could you try with a more recent Grafana version and see if it persists? Otherwise, please submit an issue on the project page.

Thank’s a lot for the hint, now it works…

1 Like