Shields: A problem about JSON

Created on 18 Apr 2020  路  2Comments  路  Source: badges/shields

Here's a question about the use of JSON to make a label:
I would like to create a label with label and message accroding to the return value of API, with information like the handle, and I need to use the message with a combination of two values.
How do to it?
By the way, how about color depending on API return values(a interger)?

question

Most helpful comment

Hello.

The dynamic JSON badge can grab a value from a JSON endpoint using JSONPath but the label and color are static.

If you want to create a badge based on a response from custom API which varies the label and color as well based on the API response, you'll need to write your own script to query that API and transform the response. Then you can use the endpoint badge: https://shields.io/endpoint

RunKit endpoints are a popular way to host them: https://runkit.com/docs/endpoint

All 2 comments

Hello.

The dynamic JSON badge can grab a value from a JSON endpoint using JSONPath but the label and color are static.

If you want to create a badge based on a response from custom API which varies the label and color as well based on the API response, you'll need to write your own script to query that API and transform the response. Then you can use the endpoint badge: https://shields.io/endpoint

RunKit endpoints are a popular way to host them: https://runkit.com/docs/endpoint

If you have any more questions, please let us know!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

calebcartwright picture calebcartwright  路  3Comments

lukeeey picture lukeeey  路  3Comments

kirankotari picture kirankotari  路  3Comments

najeeb-ur-rehman picture najeeb-ur-rehman  路  3Comments

Turnerj picture Turnerj  路  3Comments