Skip to content

Latest commit

 

History

History
189 lines (121 loc) · 5.02 KB

APISpec.md

File metadata and controls

189 lines (121 loc) · 5.02 KB

APISpec

Usage

All requests for a card are made to /api/testaustime and parameters are passed as query strings.

Endpoints

The API can take 17 different parameters:

Expand

username

Used to set the testaustime username

Example:

https://example.com/api/testaustime?username=Testauskoira

theme

Used to specify which theme to use

Example:

https://example.com/api/testaustime?username=Testauskoira&theme=dark

langs_count

Used to specify how many languages to display

Example:

https://example.com/api/testaustime?username=Testauskoira&langs_count=10

layout

Used to specify the card layout, defaults to normal.

values:

compact normal

Example:

https://example.com/api/testaustime?username=Testauskoira&layout=compact

border_radius

Used to specify the border radius in pixels.

Example:

https://example.com/api/testaustime?username=Testauskoira&border_radius=10

locale

Used to set the card title language, defaults to english.

values:

finnish english
fi en

Example:

https://example.com/api/testaustime?username=Testauskoira&locale=fi

hide_title

Used to set the visibility of the title

values:

true false

Example:

https://example.com/api/testaustime?username=Testauskoira&hide_title=true

hide_border

Used to set the visibility of the border around the card.

values:

true false

Example:

https://example.com/api/testaustime?username=Testauskoira&hide_border=true

hide

Used to hide one or more languages from the card. Can take one or more values separated by a comma.

Example:

Hiding one language:

https://example.com/api/testaustime?username=Testauskoira&hide=CSS

Hiding multiple languages:

https://example.com/api/testaustime?username=Testauskoira&hide=CSS,Python

line_height

Used to set the spacing between elements on the card in pixels, does not change the font size. This value is ignored in compact layout

Example:

https://example.com/api/testaustime?username=Testauskoira&line_height=15

hide_progress

Used to set the visibility of the language progress bar.

values:

true false

custom_title

Used to set the title text, defaults to "Testaustime Stats" in english and "Testaustime tilastot" in finnish. Remember to encode special characters like spaces as shown below.

Example:

https://example.com/api/testaustime?username=Testauskoira&custom_title=Hello%20World

coloring

Due to all of them using the same syntax, this part covers the following functions:

title_color
bg_color
text_color
icon_color
border_color

Used to set the color of the respective element in hex format. These values will override the current theme if one is specified. The bg_color parameter can take comma separated values for a gradient using the syntax degree, color1, color2

Example:

https://example.com/api/testaustime?username=Testauskoira&title_color=32a852&bg_color=3b79db

Overriding theme colors:

https://example.com/api/testaustime?username=Testauskoira&theme=dark&border_color=397a37

Setting a gradient for bg_color:

https://example.com/api/testaustime?username=Testauskoira&bg_color=45,0000ff,ff0000

api_domain

Used to specify the domain for the Testaustime server from which to fetch data. Defaults to api.testaustime.fi.

Example:

https://example.com/api/testaustime?username=Testauskoira&api_domain=api.example.com

cache_seconds

Used to set the duration for which the card will be cached in seconds. Defaults to 4 hours. This value will be clamped between 4 hours and one day.

Example:

Caching the card for 6 hours:

https://example.com/api/testaustime?username=Testauskoira&cache_seconds=21600

Caching the card for less than 4 hours will result in the card getting cached for 4 hours:

https://example.com/api/testaustime?username=Testauskoira&cache_seconds=7600

Caching the card for more than one day will result in the card getting cached for 1 day:

https://example.com/api/testaustime?username=Testauskoira&cache_seconds=90000