startpage-engine/docs/API.md
2022-02-03 21:38:54 -05:00

58 lines
2.1 KiB
Markdown

# API
This is a quick guide to start using your server (or any public) server.
## Read before using
- If you're using a server not directly controlled by you, it's implied that you are using a ``public`` server. Otherwise, set ``public`` in your ``config.json`` file to off.
It's generally recommended that you use a private, selfhosted server but I do have a public instance running for those who can't really be bothered.
## Weather API
### Private
```
GET /weather/
```
If you're running your own server and [set your config up properly](./CONFIG.md), you should just do that and your sever will be fine.
### Public
```
GET /weather/<ow-city-id>
```
#### Paramaters
- ``<ow-city-id>`` is the city ID on OpenWeatherMap you'd use for the city you want. You can simply retrieve this by going to [https://openweathermap.org/](https://openweathermap.org/) and searching for your city. The city shows up in the URL after ``/city/``
For example, if you want to find Buffalo, NY's weather. The URL for Buffalo, NY is [https://openweathermap.org/city/5110629](https://openweathermap.org/city/5110629), so the city ID would be ``5110629``. Simply set ``<ow-city-id>`` to [``5110629``](https://openweathermap.org/city/5110629). Or go to [``/weather/5110629``](https://se.tacohitbox.com/weather/5110629).
#### Querystrings
- ``measure`` can be either ``metric`` or ``imperial``. If you want the Metric measurements of Toronto (Canada), for example. The place you'd go to is [``/weather/6167865?measure=metric``]. The default from ``config.json`` is ``imperial``.
## Wallpaper API
### Private
```
GET /wall/
```
If you're running your own server and [set your config up properly](./CONFIG.md), you should just do that and your sever will be fine.
### Public
```
GET /wall/
```
You need some querystrings along with this in order for it to work.
#### Querystrings
- ``q`` is the search you're making on wallhaven.cc to get your wallpaper. The wallpaper selected is randomly chosen each time the request is set again.
For example, [``/wall/?q=sky``](https://se.tacohitbox.com/wall?q=sky) would get sky backgrounds.