Skip to content

Commit c8281c3

Browse files
committed
Merge branch 'main' of github.com:Systemik-Solutions/Glycerine_API
2 parents fbce3ea + e79b959 commit c8281c3

110 files changed

Lines changed: 12955 additions & 1137 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 1. Introduction
2+
3+
The IAW server provides the API for clients to access and manage resources. The IAW application consumes the IAW server
4+
API which means every thing that can be done in the IAW application can also be done via the IAW server API .
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 2. Authentication
2+
3+
```{note}
4+
Currently, API tokens are not opened for public users. To request an API token, please contact the administrator of
5+
the IAW platform.
6+
```
7+
8+
IAW Server uses API tokens for external clients to authenticate the requests. The token should be included in the
9+
`Authorization` header as a `Bearer` token. For example, a standard API request header would be like:
10+
11+
```
12+
Accept: application/json
13+
Authorization: Bearer {YOUR API TOKEN}
14+
```
15+
16+
##### Arguments
17+
18+
- `email`: The email of the user account.
19+
- `token-name`: A human-readable label of the API token.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 3. Usages
2+
3+
The `Accept` header should be specified as `application/json` for each API request. All API endpoints start with URL
4+
prefix `api`. For example, `/api/collections`.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 4. Responses
2+
3+
The responses of API requests are in JSON format if the request header `Accept: application/json` is specified. It
4+
returns HTTP status code `200` if the request is successful. Otherwise, it returns HTTP status code such as `400` or
5+
`500` with the body of the error messages.
6+
7+
```json
8+
{
9+
"message": "Error message summary",
10+
"errors": {
11+
"error 1": [
12+
"Details about error 1"
13+
],
14+
"error 2": [
15+
"Details about error 2"
16+
]
17+
}
18+
}
19+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 5. Users
2+
3+
#### User object
4+
5+
Each user returned from the API is a JSON object with the following properties:
6+
7+
- `id`: The ID of the user.
8+
- `name`: The name of the user.
9+
- `email`: The email of the user.
10+
- `email_verified_at`: The datetime when the email is verified.
11+
- `created_at`: The datetime when the user is created.
12+
- `updated_at`: The datetime when the user is updated.
13+
14+
#### Get the current authenticated user
15+
16+
```
17+
GET /auth-user
18+
```
19+
20+
##### Response
21+
22+
An object of the current authenticated user.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# 6. Collections
2+
3+
#### Collection object
4+
5+
Each collection returned from the API is a JSON object with the following properties:
6+
7+
- `id`: (read only) The ID of the collection.
8+
- `name`: The name of the collection.
9+
- `description`: The description of the collection.
10+
- `owner`: (read only) The owner of the collection. The value is a [user object](#user-object)
11+
which contains the properties of the owner.
12+
- `created_at`: (read only) The datetime when the collection is created.
13+
- `updated_at`: (read only) The datetime when the collection is updated.
14+
- `policies`: (read only) The policies applied to the collection for the current user. The value is an array of
15+
permission names which the current user has on the collection. The permission names are:
16+
- `access`: The user can view the collection and create image sets in the collection.
17+
- `write`: The user can update the collection properties.
18+
- `manage`: The user can share the collection with other users.
19+
- `delete`: The user can delete the collection.
20+
21+
#### Get all collections
22+
23+
```
24+
GET /collections
25+
```
26+
27+
Get all collections which can be accessed by the current authenticated user. The collections returned includes the
28+
collections owned by the user and the collections shared with the user.
29+
30+
##### Response
31+
32+
An array of collection objects.
33+
34+
#### Create a collection
35+
36+
```
37+
POST /collections
38+
```
39+
40+
##### Request
41+
42+
The request body should be a collection object used to create a new collection. Read only properties will be ignored.
43+
44+
##### Response
45+
46+
The collection object of the newly created collection.
47+
48+
#### Get a collection
49+
50+
```
51+
GET /collections/{id}
52+
```
53+
54+
Get a collection by its ID.
55+
56+
##### URL parameters
57+
58+
- `id`: The ID of the collection.
59+
60+
##### Response
61+
62+
The collection object of the queried collection.
63+
64+
#### Update a collection
65+
66+
```
67+
PUT /collections/{id}
68+
```
69+
70+
Update a collection by its ID.
71+
72+
##### URL parameters
73+
74+
- `id`: The ID of the collection.
75+
76+
##### Request
77+
78+
The request body should be a collection object used to update the collection. Read only properties will be ignored.
79+
80+
##### Response
81+
82+
The collection object after the update.
83+
84+
#### Delete a collection
85+
86+
```
87+
DELETE /collections/{id}
88+
```
89+
90+
Delete a collection by its ID.
91+
92+
##### URL parameters
93+
94+
- `id`: The ID of the collection.
95+
96+
##### Response
97+
98+
The collection object of the deleted collection.
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# 7. Image Sets
2+
3+
#### Image Set object
4+
5+
Each image set returned from the API is a JSON object with the following properties:
6+
7+
- `id`: (read only) The ID of the image set.
8+
- `name`: The name of the image set.
9+
- `description`: The description of the image set.
10+
- `attribution`: The attribution of the image set.
11+
- `owner`: (read only) The owner of the image set. The value is a [user object](#user-object)
12+
which contains the properties of the owner.
13+
- `collection`: (read only) The collection of the image set. The value is a [collection object](#collection-object)
14+
which contains the properties of the collection.
15+
- `publication`: (read only) The publication of the image set. The value is a publication object with the following
16+
properties:
17+
- `id`: The ID of the publication.
18+
- `image_set_id`: The ID of the image set of the publication.
19+
- `active`: Whether the publication is active.
20+
- `created_at`: The datetime when the publication is created.
21+
- `updated_at`: The datetime when the publication is updated.
22+
- `allowed_languages`: (read only) The allowed annotation languages of the image set. The value is an array of language
23+
objects with the following properties:
24+
- `name`: The name of the language.
25+
- `code`: The code of the language.
26+
- `thumbnail`: (read only) The URL of the thumbnail of the image set.
27+
- `image_count`: (read only) The number of images in the image set.
28+
- `created_at`: (read only) The datetime when the image set is created.
29+
- `updated_at`: (read only) The datetime when the image set is updated.
30+
- `policies`: (read only) The policies applied to the image set for the current user. The value is an array of
31+
permission names which the current user has on the image set. The permission names are:
32+
- `access`: The user can view or annotate the image set.
33+
- `write`: The user can update the image set properties.
34+
- `manage`: The user can publish the image set.
35+
- `delete`: The user can delete the image set.
36+
37+
#### Get all image sets
38+
39+
```
40+
GET /collections/{collection_id}/image-sets
41+
```
42+
43+
Get all image sets in a collection.
44+
45+
##### URL parameters
46+
47+
- `collection_id`: The ID of the collection.
48+
49+
##### Response
50+
51+
An array of image set objects.
52+
53+
#### Create an image set
54+
55+
```
56+
POST /collections/{collection_id}/image-sets
57+
```
58+
59+
Create an image set in a collection.
60+
61+
##### URL parameters
62+
63+
- `collection_id`: The ID of the collection.
64+
65+
##### Request
66+
67+
The request body should be an image set object used to create a new image set. Read only properties will be ignored.
68+
69+
It also accepts a few additional properties in the image set object:
70+
71+
- `allowed_languages`: An array of language codes which are allowed to be used in the image set for annotations.
72+
- `image_ids`: An array of IDs of the images which should be added to the image set.
73+
74+
##### Response
75+
76+
The image set object of the newly created image set.
77+
78+
#### Get an image set
79+
80+
```
81+
GET /collections/{collection_id}/image-sets/{id}
82+
```
83+
84+
Get an image set by its ID.
85+
86+
##### URL parameters
87+
88+
- `collection_id`: The ID of the collection.
89+
- `id`: The ID of the image set.
90+
91+
##### Response
92+
93+
The image set object of the queried image set.
94+
95+
#### Update an image set
96+
97+
```
98+
PUT /collections/{collection_id}/image-sets/{id}
99+
```
100+
101+
Update an image set by its ID.
102+
103+
##### URL parameters
104+
105+
- `collection_id`: The ID of the collection.
106+
- `id`: The ID of the image set.
107+
108+
##### Request
109+
110+
The request body should be an image set object used to update the image set. Read only properties will be ignored.
111+
112+
It also accepts a few additional properties in the image set object:
113+
114+
- `allowed_languages`: An array of language codes which are allowed to be used in the image set for annotations.
115+
- `image_ids`: An array of IDs of the images which should be added to the image set.
116+
- `published`: The publishing status of the image set. If it is set to `true`, the image set will be published. If it
117+
is set to `false`, the image set will be unpublished.
118+
119+
##### Response
120+
121+
The image set object after the update.
122+
123+
#### Delete an image set
124+
125+
```
126+
DELETE /collections/{collection_id}/image-sets/{id}
127+
```
128+
129+
Delete an image set by its ID.
130+
131+
##### URL parameters
132+
133+
- `collection_id`: The ID of the collection.
134+
- `id`: The ID of the image set.
135+
136+
##### Response
137+
138+
The image set object of the deleted image set.
139+
140+
#### Import IIIF manifest
141+
142+
```
143+
POST /collections/{collection_id}/import/manifest
144+
```
145+
146+
Import images from a IIIF manifest to an image set in a collection.
147+
148+
##### URL parameters
149+
150+
- `collection_id`: The ID of the collection.
151+
152+
##### Request
153+
154+
The request body should be an object with the following properties:
155+
156+
- `manifest`: The URL of the IIIF manifest.
157+
158+
##### Response
159+
160+
The image set object created from the IIIF manifest.

0 commit comments

Comments
 (0)