Skip to content

Commit 45a29d6

Browse files
committed
Updated README.md and API docs to match changes and additions
1 parent a45639e commit 45a29d6

14 files changed

Lines changed: 660 additions & 323 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ For user and calendar management there is an API endpoint. See [the API document
323323
324324
> [!TIP]
325325
>
326-
> The API endpoint requires an environment variable `API_KEY` set to a secret key that you will use in the `X-API-Key` header of your requests to authenticate. You can generate it with `bin/console api:generate`
326+
> The API endpoint requires an environment variable `API_KEY` set to a secret key that you will use in the `X-Davis-API-Token` header of your requests to authenticate. You can generate it with `bin/console api:generate`
327327
328328
## Webserver Configuration Examples
329329

docs/api/README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
# Davis API
22

3-
## Open Endpoints
3+
## API Version 1
4+
5+
### Open Endpoints
46

57
Open endpoints require no Authentication.
68

7-
* [Health](health.md) : `GET /api/health`
9+
* [Health](v1/health.md) : `GET /api/v1/health`
810

9-
## Endpoints that require Authentication
11+
### Endpoints that require Authentication
1012

11-
Closed endpoints require a valid `X-API-Key` to be included in the header of the request. Token needs to be configured in .env file (as a environment variable `API_KEY`) and can be generated using `php bin/console api:generate` command.
13+
Closed endpoints require a valid `X-Davis-API-Token` to be included in the header of the request. Token needs to be configured in .env file (as a environment variable `API_KEY`) and can be generated using `php bin/console api:generate` command.
1214

13-
### User related
15+
#### User related
1416

1517
Each endpoint displays information related to the User:
1618

17-
* [Get Users](users/all.md) : `GET /api/users`
18-
* [Get User Details](users/details.md) : `GET /api/users/:username`
19+
* [Get Users](v1/users/all.md) : `GET /api/v1/users`
20+
* [Get User Details](v1/users/details.md) : `GET /api/v1/users/:username`
1921

20-
### Calendars related
22+
#### Calendars related
2123

2224
Endpoints for viewing and modifying user calendars.
2325

24-
* [Show All User Calendars](calendars/all.md) : `GET /api/calendars/:username`
25-
* [Show User Calendar Details](calendars/details.md) : `GET /api/calendars/:username/:calendar_id`
26-
* [Show User Calendar Shares](calendars/shares.md) : `GET /api/calendars/:username/shares/:calendar_id`
27-
* [Share User Calendar](calendars/share_add.md) : `POST /api/calendars/:username/share/:calendar_id/add`
28-
* [Remove Share User Calendar](calendars/share_remove.md) : `POST /api/calendars/:username/share/:calendar_id/remove`
26+
* [Show All User Calendars](v1/calendars/all.md) : `GET /api/v1/calendars/:username`
27+
* [Show User Calendar Details](v1/calendars/details.md) : `GET /api/v1/calendars/:username/:calendar_id`
28+
* [Create User Calendar](v1/calendars/create.md) : `POST /api/v1/calendars/:username/create`
29+
* [Edit User Calendar](v1/calendars/edit.md) : `POST /api/v1/calendars/:username/:calendar_id/edit`
30+
* [Show User Calendar Shares](v1/calendars/shares.md) : `GET /api/v1/calendars/:username/shares/:calendar_id`
31+
* [Share User Calendar](v1/calendars/share_add.md) : `POST /api/v1/calendars/:username/share/:calendar_id/add`
32+
* [Remove Share User Calendar](v1/calendars/share_remove.md) : `POST /api/v1/calendars/:username/share/:calendar_id/remove`

docs/api/calendars/share_add.md

Lines changed: 0 additions & 105 deletions
This file was deleted.

docs/api/calendars/share_remove.md

Lines changed: 0 additions & 103 deletions
This file was deleted.
Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Gets a list of all available calendars for a specific user.
44

5-
**URL** : `/api/calendars/:username`
5+
**URL** : `/api/v1/calendars/:username`
66

77
**Method** : `GET`
88

@@ -17,7 +17,7 @@ Gets a list of all available calendars for a specific user.
1717
**URL example**
1818

1919
```json
20-
/api/calendars/jdoe
20+
/api/v1/calendars/jdoe
2121
```
2222

2323
## Success Response
@@ -53,15 +53,8 @@ Gets a list of all available calendars for a specific user.
5353
}
5454
],
5555
"subscriptions": []
56-
}
57-
}
58-
```
59-
60-
Shown when there are no users in Davis:
61-
```json
62-
{
63-
"status": "success",
64-
"data": []
56+
},
57+
"timestamp": "2026-01-23T15:01:33+01:00"
6558
}
6659
```
6760

@@ -73,34 +66,45 @@ Shown when user does not have calendars:
7366
"user_calendars": [],
7467
"shared_calendars": [],
7568
"subscriptions": []
76-
}
69+
},
70+
"timestamp": "2026-01-23T15:01:33+01:00"
7771
}
7872
```
7973

8074
## Error Response
8175

82-
**Condition** : If 'X-API-Key' is not present or mismatched in headers.
76+
**Condition** : If 'X-Davis-API-Token' is not present or mismatched in headers.
8377

8478
**Code** : `401 UNAUTHORIZED`
8579

8680
**Content** :
8781

8882
```json
8983
{
90-
"status": "error",
91-
"message": "Unauthorized"
84+
"message": "No API token provided",
85+
"timestamp": "2026-01-23T15:01:33+01:00"
86+
}
87+
```
88+
89+
or
90+
91+
```json
92+
{
93+
"message": "Invalid API token",
94+
"timestamp": "2026-01-23T15:01:33+01:00"
9295
}
9396
```
9497

95-
**Condition** : If ':username' is not a valid string containing chars: `a-zA-Z0-9_-`.
98+
**Condition** : If user is not found.
9699

97-
**Code** : `400 BAD REQUEST`
100+
**Code** : `404 NOT FOUND`
98101

99102
**Content** :
100103

101104
```json
102105
{
103106
"status": "error",
104-
"message": "Invalid Username"
107+
"message": "User Not Found",
108+
"timestamp": "2026-01-23T15:01:33+01:00"
105109
}
106110
```

0 commit comments

Comments
 (0)