Excerpt |
---|
Giles provides REST endpoints to specific functionality such as uploading or retrieving images. The following sections describe all so far available endpoints, their parameters, and what they return. |
Authentication
For all REST endpoints, a user has to send a valid API token (see for a description how to get a token) to authenticate. Some endpoints can be used without a token when requesting public files. Below descriptions indicate when an endpoint can be used without a token. In general, there are two ways to send a token: as request parameter or as Authorization header (this is the recommended way).
...
Code Block |
---|
language | js |
---|
title | Upload Image Sample Response from Giles |
---|
|
[ {
"documentId" : "DOCnbxbFU",
"uploadId" : "UP50N1AV",
"uploadedDate" : "2016-07-26T21:38:34.398Z",
"access" : "PRIVATE",
"files" : [ {
"filename" : "your-file.jpeg",
"path" : "http://your.host/giles/rest/digilib?fn=youruser/UP50N1AV/FILEz7JQFu/your-file.jpeg",
"content-type" : "image/jpeg",
"size" : 120830,
"success" : 0,
"id" : "FILE2FGTtG"
}, {
"filename" : "your-file-2.jpg",
"path" : "http://your.host/giles/rest/digilib?fn=youruser/UP50N1AV/FILETAW3KI/your-file-2.jpg",
"content-type" : "image/jpeg",
"size" : 270769,
"success" : 0,
"id" : "FILE23rtG"
} ]
} ] |
Get all uploads of user
You can get the details of all uploads of a user by making a GET request to:
/rest/files/uploads
Giles expects the following parameters:
- accessToken: an API token that is used to authenticate the uploading user (if possible use the Authorization header instead of this parameter)
Giles will respond with the a map of [upload ids => file ids and filename of the uploaded file]:
Code Block |
---|
[
{
"UPMDG2ddX4bDKk": [
{
"id": "FILE0fPS2iO6Ev7g",
"filename": "myfirstfile.pdf"
}
]
},
{
"UPVrMKIv": [
{
"id": "FILEkUcHBh",
"filename": "file2.0.tiff"
}
]
},
{
"UP7R6GOs": [
{
"id": "FILEkUcHBh",
"filename": "myfile2.tiff"
}
]
}
] |
Get image from Digilib
...