...
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
Token Authentication
For all REST endpoints, a user has to send a valid API token (see for here 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 |
---|
accessToken=your-api-token |
Adding Data
Add files to Giles
In theory, you can add any file type you want to Giles. However, only file types supported by Digilib or file types that Giles knows how to convert really make sense. Currently, Giles knows how to convert PDFs to images. Giles is globally configurable in regards to what image type it uses and what DPI when converting PDFs to images (default is tiff/600 dpi). Giles will create one image per PDF page and put all images together into one folder so that you can use Digilib's paginator feature. The original PDF is stored separately outside of Digilib's image folder.
...
Code Block |
---|
POST /giles/rest/files/upload HTTP/1.1
Host: giles-host
Authorization: token your-giles-token
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="files"; filename="test.png"
Content-Type: image/png
[content of file]
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="files"; filename="test.pdf"
Content-Type: application/pdf
[content of file] |
...
Giles will respond with an progress id and a url to check the progress of the upload:
...
Code Block |
---|
|
{
"msg":"Upload in progress. Please check back later.",
"msgCode":"010"
} |
Once uploading has finished, you will retrieve the complete information as listed below.
Giles Ecosystem
...
language | js |
---|
title | Upload Image Sample Response from Giles |
---|
...
As of version v0.5, Giles will also supply the URL of the upload itself (see "Get info about upload" below). Keep in mind, however, that requests to this URL will return incomplete results as long as processing of a file is ongoing. Only the poll URL will indicate when processing has finished.Once uploading has finished, you will retrieve the complete information as listed below.
Code Block |
---|
language | js |
---|
title | Upload Image Sample Response from Giles |
---|
|
[ {
"documentId" : "DOC123edf",
"uploadId" : "UPxx456",
"uploadedDate" : "2016-09-20T14:03:00.152Z",
"access" : "PRIVATE",
"uploadedFile" : {
"filename" : "uploadedFile.pdf",
"id" : "FILE466tgh",
"url" : "http://your-giles-host.net/giles/rest/files/FILE466tgh/content",
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf",
"content-type" : "application/pdf",
"size" : 3852180
},
"extractedText" : {
"filename" : "uploadedFile.pdf.txt",
"id" : "FILE123cvb",
"url" : "http://your-giles-host.net/giles/rest/files/FILE123cvb/content",
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf.txt",
"content-type" : "text/plain",
"size" : 39773
},
"pages" : [ {
"nr" : 0,
"image" : {
"filename" : "uploadedFile.pdf.0.tiff",
"id" : "FILEYUI678",
"url" : "http://your-giles-host.net/giles/rest/digilib?fn=username%FILEYUI678%2FDOC123edf0%2FuploadedFile.pdf.0.tiff",
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf.0.tiff",
"content-type" : "image/tiff",
"size" : 2032405
},
"text" : {
"filename" : "uploadedFile.pdf.0.txt",
"id" : "FILE789UIO",
"url" : "http://your-giles-host.net/giles/rest/files/FILE789UIO/content",
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf.0.txt",
"content-type" : "text/plain",
"size" : 4658
},
"ocr" : {
"filename" : "uploadedFile.pdf.0.tiff.txt",
"id" : "FILE789U12",
"url" : "http://your-giles-host.net/giles/rest/files/FILE789U12/content",
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf.0.tiff.txt",
"content-type" : "text/plain",
"size" : 4658
}
}, {
"nr" : 1,
"image" : {
"filename" : "uploadedFile.pdf.1.tiff",
"id" : "FILE045tyhG",
"url" : "http://your-giles-host.net/giles/rest/digilib?fn=username%2FFILE045tyhG%2FDOC123edf0%2FuploadedFile.pdf.1.tiff",
"path" : "username/UPxx456/DOC123edf/uploadedFile.1.tiff",
"content-type" : "image/tiff",
"size" : 2512354
},
"text" : {
"filename" : "uploadedFile.pdf.1.txt",
"id" : "FILEMDSPfeVm",
"url" : "http://your-giles-host.net/giles/rest/files/FILEMDSPfeVm/content",
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf.1.txt",
"content-type" : "text/plain",
"size" : 5799
},
"ocr" : {
"filename" : "uploadedFile.pdf.1.tiff.txt",
"id" : "FILEMDSPfe12",
"url" : "http://your-giles-host.net/giles/rest/files/FILEMDSPfe12/content",
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf.1.tiff.txt",
"content-type" : "text/plain",
"size" : 5799
}
} |
Giles Single Application v0.6 and newer
...
language | js |
---|
title | Upload Image Sample Response from Giles |
---|
...
Uploads expire after 24 hours or after a server restart. If you request an expired upload or an upload that doesn't exist you will get a 404 response with the following response body:
Code Block |
---|
{
"documentIderrorCode" : "DOC123edf404",
"uploadIderrorMsg" : "UPxx456",Upload does "uploadedDate" : "2016-09-20T14:03:00.152Z",
"access" : "PRIVATE",
"uploadedFile" : {
"filename" : "uploadedFile.pdf",
"id" : "FILE466tgh",not exist."
} |
Retrieving Data
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 |
---|
[
{
"urlUPMDG2ddX4bDKk" : "http://your-giles-host.net/giles/rest/files/FILE466tgh/content",[
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf", {
"content-type" "id": "application/pdfFILE0fPS2iO6Ev7g",
"filename": "size" : 3852180myfirstfile.pdf"
}
]
},
"extractedText" :{
"UPVrMKIv": [
{
"filenameid" : "uploadedFile.pdf.txtFILEkUcHBh",
"idfilename" : "FILE123cvbfile2.0.tiff",
"url" : "http://your-giles-host.net/giles/rest/files/FILE123cvb/content", }
]
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf.txt" },
{
"content-type" : "text/plainUP7R6GOs",: [
"size" : 39773 },
"pages" : [ {{
"nrid" : 0,
"imageFILEkUcHBh",
: { "filename" : "uploadedFile.pdf.0.tiff",myfile2.tiff"
"id"}
: "FILEYUI678", ]
"url" : "http://your-giles-host.net/giles/rest/digilib?fn=username%FILEYUI678%2FDOC123edf0%2FuploadedFile.pdf.0.tiff",
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf.0.tiff",
"content-type" : "image/tiff",
"size" : 2032405
},
"text" : {
"filename" : "uploadedFile.pdf.0.tiff.txt",
"id" : "FILE789UIO",
"url" : "http://your-giles-host.net/giles/rest/files/FILE789UIO/content",
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf.0.tiff.txt",
"content-type" : "text/plain",
"size" : 4658
}
}, {
"nr" : 1,
"image" : {
"filename" : "uploadedFile.pdf.1.tiff",
"id" : "FILE045tyhG",
"url" : "http://your-giles-host.net/giles/rest/digilib?fn=username%2FFILE045tyhG%2FDOC123edf0%2FuploadedFile.pdf.1.tiff",
"path" : "username/UPxx456/DOC123edf/uploadedFile.1.tiff",
"content-type" : "image/tiff",
"size" : 2512354
},
"text" : {
"filename" : "uploadedFile.pdf.1.tiff.txt",
"id" : "FILEMDSPfeVm",
"url" : "http://your-giles-host.net/giles/rest/files/FILEMDSPfeVm/content",
"path" : "username/UPxx456/DOC123edf/uploadedFile.pdf.1.tiff.txt",
"content-type" : "text/plain",
"size" : 5799
}
} |
Uploads expire after 24 hours or after a server restart. If you request an expired upload or an upload that doesn't exist you will get a 404 response with the following response body:
Code Block |
---|
{
"errorCode" : "404",
"errorMsg" : "Upload does not exist."
} |
v0.5 and older
For each uploaded file, Giles responds with either "success": 0
(upload was successful), or "success": 1
(upload failed).
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
You can get images from Digilib through Giles by making a GET request to:
/rest/digilib
Giles expects the following parameters:
...
Get image from Digilib
Status |
---|
colour | Green |
---|
title | Public API |
---|
|
Starting with version v0.4.2 this endpoint can be used without an access token for public images. Note that for private images an access token is required.You can get images from Digilib through Giles by making a GET request to:
/rest/digilib
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)
- 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
...
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
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: an API token that is used to authenticate the uploading user (if possible use the Authorization header instead of this parameter)
A user has only access to upload he initiated himself.
...
language | js |
---|
title | Upload Info Sample Response from Giles |
---|
...
status 403 Forbidden.
Get info about upload
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: an API token that is used to authenticate the uploading user (if possible use the Authorization header instead of this parameter)
A user has only access to upload he initiated himself.
Code Block |
---|
language | js |
---|
title | Upload Info Sample Response from Giles |
---|
|
[ "documentId" : "DOCOhcqLGMXL8dC",
"uploadId" : "UPMDG2ddX4bDKk",
"uploadedDate" : "2016-10-04T17:40:15.254Z",
"access" : "PUBLIC",
"uploadedFile" : {
"filename" : "your-file.pdf.txt",
"id" : "FILEjXRK3MKDjcqxFILE0fPS2iO6Ev7g",
"url" : "https://your.host/giles/rest/files/FILEjXRK3MKDjcqxFILE0fPS2iO6Ev7g/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.txt",
"content-type" : "textapplication/plainpdf",
"size" : 843131453836
},
"pagesextractedText" : [ {
"nr" : 0,
"image" : {
"filename" : "your-file.pdf.0.tifftxt",
"id" : "FILEgwyK2KjEiniNFILEjXRK3MKDjcqx",
"url" : "https://your.host/giles/rest/digilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.0.tiff/files/FILEjXRK3MKDjcqx/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.0.tifftxt",
"content-type" : "imagetext/tiffplain",
"size" : 84313
},
"sizepages" : 1938832[ {
"nr" : }0,
"textimage" : {
"filename" : "your-file.pdf.0.txttiff",
"id" : "FILEu3zp4FHaNBEzFILEgwyK2KjEiniN",
"url" : "https://your.host/giles/rest/files/FILEu3zp4FHaNBEz/contentdigilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.0.tiff",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.0.txttiff",
"content-type" : "textimage/plaintiff",
"size" : 3461
1938832
} }, {
"nrtext" : 1,
"image" : {
"filename" : "your-file.pdf.10.tifftxt",
"id" : "FILE1vgFj8feXHtGFILEu3zp4FHaNBEz",
"url" : "https://your.host/giles/rest/digilib?fn=username%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.1.tiff/files/FILEu3zp4FHaNBEz/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.10.tifftxt",
"content-type" : "imagetext/tiffplain",
"size" : 3461
1938382 }
}, {
"textnr" : 1,
"image" : {
"filename" : "your-file.pdf.1.txttiff",
"id" : "FILER0t8JQ1WuU94FILE1vgFj8feXHtG",
"url" : "https://your.host/giles/rest/files/FILER0t8JQ1WuU94/contentdigilib?fn=username%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.1.tiff",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.1.txttiff",
"content-type" : "text/plain",
"size" : 3930image/tiff",
} "size" },: {1938382
"nr" : 2},
"imagetext" : {
"filename" : "your-file.2pdf.1.tifftxt",
"id" : "FILEzQaVarnXZy52FILER0t8JQ1WuU94",
"url" : "https://your.host/giles/rest/digilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.2.tiff/files/FILER0t8JQ1WuU94/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.21.tifftxt",
"content-type" : "imagetext/tiffplain",
"size" : 3930
1809905 }
}, {
"nr" : 2,
"textimage" : {
"filename" : "your-file.pdf.2.txttiff",
"id" : "FILEFlTXtknorFuaFILEzQaVarnXZy52",
"url" : "https://your.host/giles/rest/files/FILEFlTXtknorFua/contentdigilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.2.tiff",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.2.txttiff",
"content-type" : "textimage/plaintiff",
"size" : 3563
}
} ]
} ] |
Get info about document
Status |
---|
colour | Green |
---|
title | Public API |
---|
|
This endpoint can be used without an API token when requesting public files.You can get information about a document by making a GET request to:
/rest/documents/{documentId}
where {documentId}
is the id of the upload you are requesting information about.
Giles Ecosystem
A response looks similar to this:
Code Block |
---|
{
"documentId" : "DOCOhcqLGMXL8dC",
"uploadId" : "UPMDG2ddX4bDKk",
"uploadedDate" : "2016-10-04T17:40:15.254Z",
"access" : "PUBLIC",
"uploadedFile" : {
"filename" : "your-file.pdf",
"id" : "FILE0fPS2iO6Ev7g",
"url" : "https://your.host/giles/rest/files/FILE0fPS2iO6Ev7g/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf",
"content-type" : "application/pdf",
"size" : 1453836
},
"extractedText "size" : 1809905
},
"text" : {
"filename" : "your-file.pdf.2.txt",
"id" : "FILEFlTXtknorFua",
"url" : "https://your.host/giles/rest/files/FILEFlTXtknorFua/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.2.txt",
"content-type" : "text/plain",
"size" : 3563
}
} ]
} ] |
Get info about document
Status |
---|
colour | Green |
---|
title | Public API |
---|
|
This endpoint can be used without an API token when requesting public files. Starting with version v0.8, the returned json contains lists of additional files for the uploaded document and each page (as shown in the example below). Before version v0.8, the additionalFiles sections are not included.You can get information about a document by making a GET request to:
/rest/documents/{documentId}
where {documentId}
is the id of the upload you are requesting information about.
A response looks similar to this:
Code Block |
---|
{
"documentId" : "DOCOhcqLGMXL8dC",
"uploadId" : "UPMDG2ddX4bDKk",
"uploadedDate" : "2016-10-04T17:40:15.254Z",
"access" : "PUBLIC",
"uploadedFile" : {
"filename" : "your-file.pdf.txt",
"id" : "FILEjXRK3MKDjcqxFILE0fPS2iO6Ev7g",
"url" : "https://your.host/giles/rest/files/FILEjXRK3MKDjcqxFILE0fPS2iO6Ev7g/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.txt",
"content-type" : "textapplication/plainpdf",
"size" : 84313
},
"pages" : [ {
"nr" : 0,
1453836
},
"imageextractedText" : {
"filename" : "your-file.pdf.0.tifftxt",
"id" : "FILEgwyK2KjEiniNFILEjXRK3MKDjcqx",
"url" : "https://your.host/giles/rest/digilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.0.tiff/files/FILEjXRK3MKDjcqx/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.0.tifftxt",
"content-type" : "imagetext/tiffplain",
"size" : 84313
1938832 },
},
"additionalFiles": [
"text" : {
"filename" : "your-file.pdf.txt.0species.txtcsv",
"id" : "FILEu3zp4FHaNBEzFILEZGpnr7Keocfh",
"url" : "httpshttp://your.host/giles/rest/files/FILEu3zp4FHaNBEzFILEZGpnr7Keocfh/content",
"path" : "other/youruser/UPMDG2ddX4bDKkUP0GCnEZg9l02y/DOCOhcqLGMXL8dCDOCGS1PfODiKbcx/your-file.pdf.txt.0species.txtcsv",
"content-type" : "text/plaincsv",
"size": 237,
"processor": "carolus"
3461 }
],
"pages" : "ocr[ {
"nr" : 0,
"image" : {
"filename" : "your-file.pdf.0.tiff.txt",
"id" : "FILEu3zp4FHaN567FILEgwyK2KjEiniN",
"url" : "https://your.host/giles/rest/files/FILEu3zp4FHaN567/contentdigilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.0.tiff",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.0.tiff.txt",
"content-type" : "textimage/plaintiff",
"size" : 3461
1938832
} }, {
"nrtext" : 1,
"image" : {
"filename" : "your-file.pdf.10.tifftxt",
"id" : "FILE1vgFj8feXHtGFILEu3zp4FHaNBEz",
"url" : "https://your.host/giles/rest/digilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.1.tiff/files/FILEu3zp4FHaNBEz/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.10.tifftxt",
"content-type" : "imagetext/tiffplain",
"size" : 19383823461
},
"textocr" : {
"filename" : "your-file.pdf.0.1tiff.txt",
"id" : "FILER0t8JQ1WuU94FILEu3zp4FHaN567",
"url" : "https://your.host/giles/rest/files/FILER0t8JQ1WuU94FILEu3zp4FHaN567/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.0.1tiff.txt",
"content-type" : "text/plain",
"size" : 39303461
},
"additionalFiles": [
"ocr" : {
"filename" : "your-file.pdf.10.tiff.txt.species.csv",
"id" : "FILER123JQ1WuU94FILE9K9XJuIrN28X",
"url" : "httpshttp://your.host/giles/rest/files/FILER123JQ1WuU94FILE9K9XJuIrN28X/content",
"path" : "other/youruser/UPMDG2ddX4bDKkUP0GCnEZg9l02y/DOCOhcqLGMXL8dCDOCGS1PfODiKbcx/your-file.pdf.10.tiff.txt.species.csv",
"content-type" : "text/plaincsv",
"size": 25,
"processor": "carolus"
3930 }
]
}, {
"nr" : 21,
"image" : {
"filename" : "your-file.pdf.21.tiff",
"id" : "FILEzQaVarnXZy52FILE1vgFj8feXHtG",
"url" : "https://your.host/giles/rest/digilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.21.tiff",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.21.tiff",
"content-type" : "image/tiff",
"size" : 18099051938382
},
"text" : {
"filename" : "your-file.pdf.21.txt",
"id" : "FILEFlTXtknorFuaFILER0t8JQ1WuU94",
"url" : "https://your.host/giles/rest/files/FILEFlTXtknorFuaFILER0t8JQ1WuU94/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.21.txt",
"content-type" : "text/plain",
"size" : 35633930
},
"ocr" : {
"filename" : "your-file.pdf.21.tiff.txt",
"id" : "FILEFlTXtkn345uaFILER123JQ1WuU94",
"url" : "https://your.host/giles/rest/files/FILEFlTXtkn345uaFILER123JQ1WuU94/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.21.tiff.txt",
"content-type" : "text/plain",
"size" : 35633930
}
} |
Giles Single Application
A response looks similar to this:
Code Block |
---|
{
"documentId" : "DOCOhcqLGMXL8dC",
"uploadId" : "UPMDG2ddX4bDKk",
"uploadedDate" : "2016-10-04T17:40:15.254Z",
"access" : "PUBLIC,
"additionalFiles": [
{
"filename": "your-file.pdf.1.tiff.txt.species.csv",
"uploadedFile" : { "filenameid" : "your-file.pdfFILE9K9XJuIrN890",
"id" : "FILE0fPS2iO6Ev7g", "url" : "httpshttp://your.host/giles/rest/files/FILE0fPS2iO6Ev7gFILE9K9XJuIrN890/content",
"path" : "other/youruser/UPMDG2ddX4bDKkUP0GCnEZg9l02y/DOCOhcqLGMXL8dCDOCGS1PfODiKbcx/your-file.pdf",.1.tiff.txt.species.csv",
"content-type": "text/csv",
"size": 23,
"content-typeprocessor" : "application/pdf",carolus"
}
]
}, {
"sizenr" : 1453836
2,
}, "extractedTextimage" : {
"filename" : "your-file.pdf.txt2.tiff",
"id" : "FILEjXRK3MKDjcqxFILEzQaVarnXZy52",
"url" : "https://your.host/giles/rest/files/FILEjXRK3MKDjcqx/contentdigilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.2.tiff",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.2.txttiff",
"content-type" : "text/plain",
"size" : 84313image/tiff",
}, "pagessize" : [ {1809905
"nr" : 0},
"imagetext" : {
"filename" : "your-file.pdf.02.tifftxt",
"id" : "FILEgwyK2KjEiniNFILEFlTXtknorFua",
"url" : "https://your.host/giles/rest/digilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.0.tiff/files/FILEFlTXtknorFua/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.02.tifftxt",
"content-type" : "imagetext/tiffplain",
"size" : 19388323563
},
"textocr" : {
"filename" : "your-file.pdf.02.tiff.txt",
"id" : "FILEu3zp4FHaNBEzFILEFlTXtkn345ua",
"url" : "https://your.host/giles/rest/files/FILEu3zp4FHaNBEzFILEFlTXtkn345ua/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.02.tiff.txt",
"content-type" : "text/plain",
"size" : 3461
3563
} },
{
"additionalFiles": [
"nr" : 1, {
"image" : { "filename" : "your-file.pdf.12.tiff.txt.species.csv",
"id" : "FILE1vgFj8feXHtGFILE9K9XJuI78YUR",
"url" : "httpshttp://your.host/giles/rest/digilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.1.tiff/files/FILE9K9XJuI78YUR/content",
"path" : "other/youruser/UPMDG2ddX4bDKkUP0GCnEZg9l02y/DOCOhcqLGMXL8dCDOCGS1PfODiKbcx/your-file.pdf.12.tiff.txt.species.csv",
"content-type": "text/csv" : "image/tiff",,
"size": 30,
"processor": "sizecarolus"
: 1938382 },
]
"text" : {
"filename" : "your-file.pdf.1.txt",
"id" : "FILER0t8JQ1WuU94",
"url" : "https://your.host/giles/rest/files/FILER0t8JQ1WuU94/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.1.txt",
"content-type" : "text/plain",
"size" : 3930
}
}, {
"nr" : 2,
"image" : {
"filename" : "your-file.pdf.2.tiff",
"id" : "FILEzQaVarnXZy52",
"url" : "https://your.host/giles/rest/digilib?fn=youruser%2FUPMDG2ddX4bDKk%2FDOCOhcqLGMXL8dC%2Fyour-file.pdf.2.tiff",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.2.tiff",
"content-type" : "image/tiff",
"size" : 1809905
},
"text" : {
"filename" : "your-file.pdf.2.txt",
"id" : "FILEFlTXtknorFua",
"url" : "https://your.host/giles/rest/files/FILEFlTXtknorFua/content",
"path" : "youruser/UPMDG2ddX4bDKk/DOCOhcqLGMXL8dC/your-file.pdf.2.txt",
"content-type" : "text/plain",
"size" : 3563
}
} |
Get full image from Giles
Status |
---|
colour | Green |
---|
title | Public API |
---|
|
This endpoint can be used without an API token when requesting public files.You can get the original version of a file that you have uploaded through Giles by making a GET request to:
/rest/files/{fileId}/content
where {fileId}
is the id of the file you are trying to download.
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)
Note: when requesting information about an upload, or after uploading a file, the path property of the JSON response will point here for PDF files.
...
Get full image from Giles
Status |
---|
colour | Green |
---|
title | Public API |
---|
|
This endpoint can be used without an API token when requesting public files.You can get the original version of a file that you have uploaded through Giles by making a GET request to:
/rest/files/{fileId}/content
where {fileId}
is the id of the file you are trying to download.
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)
Note: when requesting information about an upload, or after uploading a file, the path property of the JSON response will point here for PDF files.
Modifying Data
Change Document Access
This features is available with version v0.4.2.You can change the access type of a document (private or public) by making a POST request to:
/rest/documents/{documentId}/access/change
where {documentId}
is the id of the document you want to change the access type.
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)
- access: the new type of access for the specified document:
private
or public
Search
Search with Freddie
Starting with version v0.5 documents submitted to Giles can be search if Freddie has been added to the ecosystem.You can search all text documents of a user by making a GET request to:
/rest/search?q={querystring}
where {querystring}
is a Solr query string.
Giles expects the following parameters:
- q: the query string
- 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 to a search request with a list of results, similar to:
Code Block |
---|
[{
"id": "FILEqvXix777A6er",
"uploadId": "UPsQY6W7CbBsl1",
"filename": "GraceHopper.pdf.0.txt",
"documentId": "DOC8uY40VmywRMe",
"uploadDate": "2017-04-27T16:33:39.428Z",
"access": "PRIVATE",
"contentType": "text/plain",
"size": 0,
"url": "http://your.giles.host/giles/rest/files/FILEqvXix777A6er/content",
"documentUrl": "http://your.giles.host/giles/rest/documents/DOC8uY40VmywRMe",
"page": 0
}
] |