Pixel-perfect Retina-ready Fast Consistent Hackable No tracking
/endpoint?url=...&style=...
Endpoint response:
{
"schemaVersion": 1,
"label": "hello",
"message": "sweet world",
"color": "orange"
}
Shields response:
Developers rely on Shields for visual consistency and powerful customization options. As a service provider or data provider, you can use the endpoint badge to provide content while giving users the full power of Shields' badge customization.
Using the endpoint badge, you can provide content for a badge through a JSON endpoint. The content can be prerendered, or generated on the fly. To strike a balance between responsiveness and bandwidth utilization on one hand, and freshness on the other, cache behavior is configurable, subject to the Shields minimum. The endpoint URL is provided to Shields through the query string. Shields fetches it and formats the badge.
The endpoint badge is a better alternative than redirecting to the static badge endpoint or generating SVG on your server:
Breaking changes to the schema will trigger an increment to the `schemaVersion`.
1
.lightgrey
. The right color. Supports the eight named colors above, as well as hex, rgb, rgba, hsl, hsla and css named colors. This can be overridden by the query string.grey
. The left color. This can be overridden by the query string.false
. true
to treat this as an error badge. This prevents the user from overriding the color. In the future, it may affect cache behavior.flat
. The default template to use. Can be overridden by the query string.300
, min 300
. Set the HTTP cache lifetime in seconds, which should be respected by the Shields' CDN and downstream users. Values below 300 will be ignored. This lets you tune performance and traffic vs. responsiveness. The value you specify can be overridden by the user via the query string, but only to a longer value.
Have an idea for an awesome new badge?
Tell us about it and we might bring it to you!