Documentation · API reference
PATCH
/api/v1/sites/{site}Change a site's settings
This page as Markdown, or in an AI chatMore ways to read this page
Change a site's settings: only what is sent changes, and each change is kept in the site's history.
# Change a site's settings
> tidekeeper's API reference: https://tidekeeper.eu/docs/api/patch-sites-site
`PATCH /api/v1/sites/{site}`
Change a site's settings: only what is sent changes, and each change is kept in the site's history.
## Parameters
- `site` (in path, needed): A site's id or name
## What to send
`SiteUpdate`: Change a site. Whatever is left out stays as it is.
- `hostnames` (list of string or null)
- `paused` (boolean or null)
- `resume` (string or null): With `paused: true`: when counting starts again by itself. `hour` is in an hour, `tomorrow` is 09:00 the next day in the site's own time. Left out, it stays paused until someone says otherwise.
- `settings` (object or null)
- `time_zone` (string or null)
## The answer
200, `SiteView`
- `created_at` (string, needed)
- `declared` (boolean, needed): Declared in the instance's configuration: read-only here, pausable.
- `hostnames` (list of string, needed): Hostnames allowed to send hits for this site.
- `id` (string, needed)
- `mode` (string, needed): `easy` or `hard`.
- `name` (string, needed): The name the tag carries (`data-site`).
- `paused` (boolean, needed)
- `reading` (string, needed): `strict` or `cnil`.
- `settings` (object, needed)
- `time_zone` (string, needed)
## Asking
```sh
curl -X PATCH https://tidekeeper.eu/api/v1/sites/example.org \
-H "Authorization: Bearer $TIDEKEEPER_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
```
Parameters
- sitein the address
- neededA site's id or name
What to send
SiteUpdate Change a site. Whatever is left out stays as it is.
- hostnames
- list of string or null
- paused
- boolean or null
- resume
- string or nullWith `paused: true`: when counting starts again by itself. `hour` is in an hour, `tomorrow` is 09:00 the next day in the site's own time. Left out, it stays paused until someone says otherwise.
- settings
- object or null
- time_zone
- string or null
The answer
Status 200
SiteView
- created_at
- stringneeded
- declared
- booleanneededDeclared in the instance's configuration: read-only here, pausable.
- hostnames
- list of stringneededHostnames allowed to send hits for this site.
- id
- stringneeded
- mode
- stringneeded`easy` or `hard`.
- name
- stringneededThe name the tag carries (`data-site`).
- paused
- booleanneeded
- reading
- stringneeded`strict` or `cnil`.
- settings
- objectneeded
- time_zone
- stringneeded
Asking
curl -X PATCH https://tidekeeper.eu/api/v1/sites/example.org \ -H "Authorization: Bearer $TIDEKEEPER_TOKEN" \ -H "Content-Type: application/json" \ -d '{}'
const answer = await fetch("https://tidekeeper.eu/api/v1/sites/example.org", { method: "PATCH", headers: { Authorization: `Bearer ${process.env.TIDEKEEPER_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({}), }).then((r) => r.json());