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.
Add files to Giles
POST
You can add files to Giles by making a POST request to:
/rest/files/upload
You request should be made with a content-type header of:
multipart/form-data
Giles expects the following parameters:
accessToken: a github access token that is used to authenticate the uploading user
access (optional): access policy for uploaded files; possible values are PRIVATE or PUBLIC; default is PRIVATE.
document_type (optional): specifies if uploaded files are several pages of the same document (MULTI_PAGE) or if they should be uploaded as separate documents (SINGLE_PAGE); default is SINGLE_PAGE.
files: the files to be uploaded
For each uploaded file, Giles responds with either "success": 0
(upload was successful), or "success": 1
(upload failed).
[ { "documentId" : "DOCnbxbFU", "uploadId" : "UP50N1AV", "uploadedDate" : "2016-07-26T21:38:34.398Z", "access" : "PRIVATE", "files" : [ { "filename" : "IMG_2836.jpeg", "path" : "http://diging-dev.asu.edu:8081/giles-review/rest/digilib?fn=jdamerow/UP50N1AV/FILEz7JQFu/IMG_2836.jpeg", "content-type" : "image/jpeg", "size" : 120830, "success" : 0 }, { "filename" : "IMG_0306.jpg", "path" : "http://diging-dev.asu.edu:8081/giles-review/rest/digilib?fn=jdamerow/UP50N1AV/FILETAW3KI/IMG_0306.jpg", "content-type" : "image/jpeg", "size" : 270769, "success" : 0 } ] } ]
Get image from Digilib
GET
You can get images from Digilib through Giles by making a GET request to:
/rest/digilib
Giles expects the following parameters:
- accessToken: a github access token that is used to authenticate the uploading user
- fn: path to image in digilib
- dw or dh: you need at least one size parameter, either width (dw) or height (dh) or both
- any other digilib parameter (optional)
Get public image from Digilib
GET
You can get public images from Digilib without a GitHub access token by making a GET request to:
/rest/digilib/public
Giles expects the following parameters:
- fn: path to image in digilib
- dw or dh: you need at least one size parameter, either width (dw) or height (dh) or both
- any other digilib parameter (optional)
If the requested image is set to public, Giles will return the image from Digilib. Otherwise, you will receive an http status 403 Forbidden.
Get info about upload
GET
You can get information about an upload by making a GET request to:
/rest/files/upload/{uploadId}
where {uploadId}
refers to an id of a previous upload.
Giles expects the following parameters:
- accessToken: a github access token that is used to authenticate the uploading user
A user has only access to upload he initiated himself.
[ { "documentId" : "DOCDdXVqo", "uploadId" : "UPR8QVBL", "uploadedDate" : "2016-07-25T17:17:04.944Z", "access" : "PRIVATE", "files" : [ { "filename" : "IMG_2836.jpeg", "path" : "http://diging-dev.asu.edu:8081/giles-review/rest/digilib?fn=jdamerow/UPR8QVBL/FILExedxqn/IMG_2836.jpeg", "content-type" : "image/jpeg", "size" : 120830 } ] } ]