Skip to content

Commit a9568c3

Browse files
committed
Added docs for API tokens and access
1 parent 0194679 commit a9568c3

File tree

5 files changed

+68
-3
lines changed

5 files changed

+68
-3
lines changed

docs/self-hosting/guides/docker.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,35 @@ There you can enter the API URL and the client ID.
167167

168168
<img src="/img/solidtime-desktop-instance-settings-2.png" alt="Screenshot of soldtime Desktop showing the Instance Settings interface" width="500" />
169169

170+
### 10. Activate API access via user API tokens (optional)
171+
172+
solidtime has a feature that allows users to create API tokens to access the API.
173+
This can be used to automate tasks or to create integrations with other services.
174+
175+
To activate this feature you need to create a OAuth client via the CLI.
176+
177+
```bash
178+
docker compose exec scheduler php artisan passport:client --personal --name="API"
179+
```
180+
181+
This command will create the client in the database and output the client ID and the client secret.
182+
The client ID and the client need to be added to the `laravel.env` file.
183+
184+
```env
185+
PASSPORT_PERSONAL_ACCESS_CLIENT_ID="insert-id"
186+
PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET="insert-secret"
187+
```
188+
189+
After you added the client ID and the client secret to the `laravel.env` file, you need to restart the containers.
190+
191+
```bash
192+
docker compose down && docker compose up -d
193+
```
194+
195+
Now users can create API tokens in the user settings.
196+
Read more about how you can create an API token and how to use the API [here](/user-guide/access-api).
197+
198+
170199
## Update
171200

172201
To update solidtime, you can pull the latest image from the Docker registry.

docs/user-guide/access-api.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
sidebar_position: 6
3+
---
4+
5+
# API access
6+
7+
The solidtime API is a RESTful API that allows you to access and manipulate data in solidtime.
8+
The API is designed to be easy to use and to provide all the functionality that is available in the solidtime web application.
9+
10+
## Creating an API Token
11+
12+
To access the API, you need an API token.
13+
You can create an API token in the user settings.
14+
15+
1. Click on "Profile Settings" in the bottom left corner
16+
2. Scroll down to the "Create API Token" section
17+
3. Enter a name and click on "Create API Token"
18+
4. The API token will be displayed in a popup. Copy the token and store it in a safe place.
19+
20+
:::warning
21+
The API token is only displayed once. If you lose the token, you need to create a new one.
22+
:::
23+
24+
## Using the API
25+
26+
The API token is a JWT token.
27+
You need to add the token to the Authorization header of your HTTP requests with a `Bearer ` prefix.
28+
29+
**Example:**
30+
31+
```
32+
Authorization: Bearer <api-token>
33+
```
34+
35+
All API endpoints are documented in [the API reference](/api-reference).
36+

docs/user-guide/billable-rates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 4
2+
sidebar_position: 3
33
---
44

55
# Billable rates

docs/user-guide/export.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 6
2+
sidebar_position: 5
33
---
44

55
# Export

docs/user-guide/import.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 5
2+
sidebar_position: 4
33
---
44

55
# Import

0 commit comments

Comments
 (0)