radar app logo
Radar 

Customizing the Value

After adding an API, you will see N/A right next to the name of the API you added. To display the needed data, you need to complete this step. There are two ways you can bring the data to Radar.

If you had added the data from a one-click installer, you could still customize the value. Click on the pencil icon next to the listing and select next. After that, you can continue following this guide.

There are two ways you can customize the value displayed.

  1. JSON path - Pick any value from the API response and add prefix, suffix, etc.,
  2. Custom JavaScript Code - Bring custom JS code to customize what you want to display.

JSON path

You can input the JSON path of the data in the API response to the primary value or secondary value textbox. If you don't know the JSON path of the data, click on the Get help link.

Loading...

It will open a webpage on getradar.co, and you can copy the JSON path by clicking on the icon that appears when you mouse over the data you want.

Loading...

Now, paste the copied data in the primaryValue or secondaryValue column and select Save to get the data on Radar.

Radar supports mustache templates for the JSON path values. This way, you can prefix or suffix additional string to your API data. You can also add more than one JSON path.

Let us say you want to add the $ symbol to your data on Radar and the JSON path is data.priceUsd. You can fill primary value textbox with ${{data.priceUsd}} to prefix $ to your data.

Loading...

To display data from more than one JSON path, just concatenate mustache templates. For example, {{data.currency}} {{data.price}}.

Custom JavaScript Code

If the API data needs some post-processing, you can customize it using custom JavaScript code. Check 'Customize data before displaying with JavaScript'.

Loading...

Now, you will see a code editor. Starting from line #10, you can add any custom code. The code editor supports auto-completion. data variable contains your API response.

Let us take our Bitcoin price API as an example. What if the API data has more numbers after the decimal point? Check the GIF above to see how we fix it with custom JavaScript code.

Assign values to primaryValue or secondaryValue or both. Resolve the issues Radar report and save.