GraphGrid Files
2.0
API Version 1.0
Introduction
GraphGrid Files allows users to upload a file into a bucket in S3. Any file types may be uploaded. Click here for more information on how to configure AWS with GraphGrid.
API
This Files API version is 1.0 and as such all endpoints are rooted at /1.0/
. For example, http://localhost/1.0/files
(requires auth) would be the base context for this Files API under the GraphGrid API deployed at http://localhost.
Get Status
Check the status of GraphGrid Files. Will return a 200 OK
response if healthy.
Base URL: /1.0/files/status
Method: GET
Request
curl --location --request GET "${API_BASE}/1.0/files/status"
Response
{
"status": "OK"
}
Get Authenticated
Checks token for authorization to use the Files API.
- BaseURL:
/1.0/files/upload
- Method: GET
curl --location --request GET 'http://localhost/1.0/files/authenticated' \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"status": "AUTHENTICATED"
}
Upload Files
Upload a file to S3 and create a File
node in ONgDB.
- BaseURL:
/1.0/files/upload
- Method: POST
Params
Parameter | Description |
---|---|
bucket Optional | The name of the bucket in S3. Default: graphgrid-files-private or graphgrid-files-puiblic depending on makePublic param |
region Optional | The configured AWS region. Default: us-west-2 |
key | The name of the unique identifier for an object within a bucket. |
metadata | The required metadata to upload a file and write it to ONgDB. |
fileData | The path to the file. |
expiration | Timeout option for remote operation. |
makePublic | Option to make uploaded file public (true ) or private (false ). |
bucket
parameter is unassigned and the makePublic
parameter is set to true
, the file will be uploaded to the default bucketgraphgrid-files-public
. Assigning false
will upload the file to the default bucket graphgrid-files-private
.
Request
curl --location --request POST "${API_BASE}/1.0/files/upload" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--form 'bucket="graphgrid-files-public"' \
--form 'region="us-east-1"' \
--form 'key="test"' \
--form 'metadata="{\"createRelationships\":[]%2C \"createProperties\":{\"md5\":\"auto\"%2C \"sha1\":\"auto\"%2C \"sha256\":\"auto\"%2C \"description\":\"Some Description\"}}"' \
--form 'fileData=@"/Projects/MyProject.png"' \
--form 'expiration="300"' \
--form 'makePublic="true"'
Response
{
"uploadFileResults": [
{
"file": {
"id": 35025717,
"labels": [],
"enver": 0,
"createdAt": "2022-09-02T15:31:29+00:00",
"updatedAt": "2022-09-02T15:31:29+00:00",
"createdBy": "webmasteratgraphgriddotcom",
"lastModifiedBy": "webmasteratgraphgriddotcom",
"grn": "grn:gg:file:0A53BusPulfmNpz4LXZNetRUu0MQzMClCFshFoq4zlxr",
"filename": "MyProject.png",
"contentType": "image/png",
"size": 206215,
"bucket": "graphgrid-files-public",
"key": "test/12ab3444cde8ffbbbb179999a99e0e009bb7fb0c90c09f0909109b098ffd009f/MyProject.png",
"url": "https://graphgrid-files-public.s3.amazonaws.com/test/12ab3444cde8ffbbbb179999a99e0e009bb7fb0c90c09f0909109b098ffd009f/MyProject.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20220902T153124Z&X-Amz-SignedHeaders=host&X-Amz-Expires=299&X-Amz-Credential=YiHbuWh5BuXDDFsIaowaMjBLtOjsBMIPiQ14jskZbochQ
us-east-1%2Fs3%2Faws4_request&X-Amz-Signature=dshBSQMAr5VcH3WhSTWloIfA3zPtXnHMMfamb8LWpnUh1WJbs61d6pjtez15y7bG",
"description": "Some Description",
"md5": "jTpV14GGYV1tAnolOwACOVg1x26Ap3Tc",
"sha1": "4d8031eab5e871034c1cfc3cab58471cf70a25f9",
"sha256": "60df4133edc8ffbfdc179037a78e0e359bb7fb0c92c85f12d6109b468ffd045f",
"thumbnailImageFormat": {
"id": 35025721,
"labels": [],
"enver": 0,
"createdAt": "2022-09-02T15:31:29+00:00",
"updatedAt": "2022-09-02T15:31:29+00:00",
"createdBy": "webmasteratgraphgriddotcom",
"lastModifiedBy": "webmasteratgraphgriddotcom",
"grn": "grn:gg:imageformat:WBSAvW9jbUqZtmSPkVk3YaHj0ejVrlmTz1o7utgzcW89",
"format": "THUMBNAIL",
"width": 90,
"height": 90,
"originalUrl": "https://graphgrid-files-public.s3.amazonaws.com/test/12ab3444cde8ffbbbb179999a99e0e009bb7fb0c90c09f0909109b098ffd009f/MyProject.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20220902T153124Z&X-Amz-SignedHeaders=host&X-Amz-Expires=299&X-Amz-Credential=YiHbuWh5BuXDDFsIaowaMjBLtOjsBMIPiQ14jskZbochQ
us-east-1%2Fs3%2Faws4_request&X-Amz-Signature=dshBSQMAr5VcH3WhSTWloIfA3zPtXnHMMfamb8LWpnUh1WJbs61d6pjtez15y7bG",
"md5": "c737a6c423ffd29681f9576ced5ed2f9",
"url": "http://localhost/1.0/file/download?grns=grn:gg:imageformat:WBSAvW9jbUqZtmSPkVk3YaHj0ejVrlmTz1o7utgzcW89®ion=us-east-1&expiration=300",
"grnType": "imageformat",
"label": "ImageFormat"
},
"smallImageFormat": {
"id": 35025713,
"labels": [],
"enver": 0,
"createdAt": "2022-09-02T15:31:29+00:00",
"updatedAt": "2022-09-02T15:31:29+00:00",
"createdBy": "webmasteratgraphgriddotcom",
"lastModifiedBy": "webmasteratgraphgriddotcom",
"grn": "grn:gg:imageformat:bm4XfPCXahQs6puqrdGuj3Ilj6ZJ5JBE7BvpwLFVUCOZ",
"format": "SMALL",
"width": 180,
"height": 180,
"originalUrl": "https://graphgrid-files-public.s3.amazonaws.com/test/12ab3444cde8ffbbbb179999a99e0e009bb7fb0c90c09f0909109b098ffd009f/MyProject.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20220902T153124Z&X-Amz-SignedHeaders=host&X-Amz-Expires=299&X-Amz-Credential=YiHbuWh5BuXDDFsIaowaMjBLtOjsBMIPiQ14jskZbochQ
us-east-1%2Fs3%2Faws4_request&X-Amz-Signature=dshBSQMAr5VcH3WhSTWloIfA3zPtXnHMMfamb8LWpnUh1WJbs61d6pjtez15y7bG",
"md5": "8667da98bed6de4de23b726991339ecb",
"url": "http://localhost/1.0/file/download?grns=grn:gg:imageformat:bm4XfPCXahQs6puqrdGuj3Ilj6ZJ5JBE7BvpwLFVUCOZ®ion=us-east-1&expiration=300",
"grnType": "imageformat",
"label": "ImageFormat"
},
"mediumImageFormat": {
"id": 35025674,
"labels": [],
"enver": 0,
"createdAt": "2022-09-02T15:31:29+00:00",
"updatedAt": "2022-09-02T15:31:29+00:00",
"createdBy": "webmasteratgraphgriddotcom",
"lastModifiedBy": "webmasteratgraphgriddotcom",
"grn": "grn:gg:imageformat:PZhTzleLtKSV8V5sqaGz6UVMgAVftX7GDU4nDwQI0jKu",
"format": "MEDIUM",
"width": 360,
"height": 360,
"originalUrl": "https://graphgrid-files-public.s3.amazonaws.com/test/12ab3444cde8ffbbbb179999a99e0e009bb7fb0c90c09f0909109b098ffd009f/MyProject.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20220902T153124Z&X-Amz-SignedHeaders=host&X-Amz-Expires=299&X-Amz-Credential=YiHbuWh5BuXDDFsIaowaMjBLtOjsBMIPiQ14jskZbochQ
us-east-1%2Fs3%2Faws4_request&X-Amz-Signature=dshBSQMAr5VcH3WhSTWloIfA3zPtXnHMMfamb8LWpnUh1WJbs61d6pjtez15y7bG",
"md5": "jTpV14GGYV1tAnolOwACOVg1x26Ap3Tc",
"url": "http://localhost/1.0/file/download?grns=grn:gg:imageformat:PZhTzleLtKSV8V5sqaGz6UVMgAVftX7GDU4nDwQI0jKu®ion=us-east-1&expiration=300",
"grnType": "imageformat",
"label": "ImageFormat"
},
"largeImageFormat": {
"id": 35025568,
"labels": [],
"enver": 0,
"createdAt": "2022-09-02T15:31:29+00:00",
"updatedAt": "2022-09-02T15:31:29+00:00",
"createdBy": "webmasteratgraphgriddotcom",
"lastModifiedBy": "webmasteratgraphgriddotcom",
"grn": "grn:gg:imageformat:kdNTAyLzIajmz4Xu01sNcEPOpUv51kfmcokV5JFEg9kq",
"format": "LARGE",
"width": 720,
"height": 720,
"originalUrl": "https://graphgrid-files-public.s3.amazonaws.com/test/12ab3444cde8ffbbbb179999a99e0e009bb7fb0c90c09f0909109b098ffd009f/MyProject.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20220902T153124Z&X-Amz-SignedHeaders=host&X-Amz-Expires=299&X-Amz-Credential=YiHbuWh5BuXDDFsIaowaMjBLtOjsBMIPiQ14jskZbochQ
us-east-1%2Fs3%2Faws4_request&X-Amz-Signature=dshBSQMAr5VcH3WhSTWloIfA3zPtXnHMMfamb8LWpnUh1WJbs61d6pjtez15y7bG",
"md5": "c18405d2a2d64d3c2ff011a0d03280dd",
"url": "http://localhost/1.0/file/download?grns=grn:gg:imageformat:kdNTAyLzIajmz4Xu01sNcEPOpUv51kfmcokV5JFEg9kq®ion=us-east-1&expiration=300",
"grnType": "imageformat",
"label": "ImageFormat"
},
"grnType": "file",
"label": "File"
},
"uploadResult": {
"bucketName": "graphgrid-files-public",
"key": "test/12ab3444cde8ffbbbb179999a99e0e009bb7fb0c90c09f0909109b098ffd009f/MyProject.png",
"versionId": null,
"etag": "jTpV14GGYV1tAnolOwACOVg1x26Ap3Tc"
}
}
]
}
Get file by grn
Return a file by its grn
- BaseURL:
/1.0/file/{{fileGrn}}
- Method: GET
curl --location --request GET " ${API_BASE}/1.0/file/grn:gg:file:cMuuifdsrcfsuJmpOYUaK9PAud6pkAyCbZJhQ8BQFIB7" \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Response
{
"id": 3,
"labels": ["GraphGridResource"],
"enver": 0,
"createdAt": "2022-09-09T15:42:11.625Z",
"updatedAt": "2022-09-09T15:42:11.625Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:file:cMuuifdsrcfsuJmpOYUaK9PAud6pkAyCbZJhQ8BQFIB7",
"filename": "10_10.png",
"contentType": "image/png",
"size": 10553,
"bucket": "graphgrid-files-public",
"key": "test/a0a009e52f9fef08980a4a3df2ed83cd48c5f4cc3b4da21eb0d1b9676aaf7413/10_10.png",
"url": "http://localhost/1.0/files/download?grns=grn:gg:file:cMuuifdsrcfsuJmpOYUaK9PAud6pkAyCbZJhQ8BQFIB7®ion=us-west-2&expiration=300",
"description": "Some Description",
"md5": "8a0950587571520b256d53ad365fa07e",
"sha1": "1f9fe5872d7201b4faccf44f49f8f16407eac411",
"sha256": "a0a009e52f9fef08980a4a3df2ed83cd48c5f4cc3b4da21eb0d1b9676aaf7413",
"thumbnailImageFormat": {
"id": 2,
"labels": ["GraphGridResource"],
"enver": 0,
"createdAt": "2022-09-09T15:42:12.302Z",
"updatedAt": "2022-09-09T15:42:12.302Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:imageformat:VFpUmtKtbAhiR9Dw7jtpgzEMkRb8hS8JcZLXZGw0DjoN",
"format": "THUMBNAIL",
"width": 90,
"height": 90,
"originalUrl": "http://localhost/1.0/files/download?grns=grn:gg:file:cMuuifdsrcfsuJmpOYUaK9PAud6pkAyCbZJhQ8BQFIB7®ion=us-west-2&expiration=300",
"md5": "~�w�3p�~,]dJ���",
"url": "http://localhost/1.0/files/download?grns=grn:gg:imageformat:VFpUmtKtbAhiR9Dw7jtpgzEMkRb8hS8JcZLXZGw0DjoN®ion=us-west-2&expiration=300",
"grnType": "imageformat",
"label": "ImageFormat"
},
"smallImageFormat": {
"id": 64,
"labels": ["GraphGridResource"],
"enver": 0,
"createdAt": "2022-09-09T15:42:11.824Z",
"updatedAt": "2022-09-09T15:42:11.824Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:imageformat:JY6ApBLdUHu7R5BA57onIjVF4fHMhWmfb4WH8ZjSvWBV",
"format": "SMALL",
"width": 180,
"height": 180,
"originalUrl": "http://localhost/1.0/files/download?grns=grn:gg:file:cMuuifdsrcfsuJmpOYUaK9PAud6pkAyCbZJhQ8BQFIB7®ion=us-west-2&expiration=300",
"md5": "Pc�%�P��>L[�I���",
"url": "http://localhost/1.0/files/download?grns=grn:gg:imageformat:JY6ApBLdUHu7R5BA57onIjVF4fHMhWmfb4WH8ZjSvWBV®ion=us-west-2&expiration=300",
"grnType": "imageformat",
"label": "ImageFormat"
},
"mediumImageFormat": {
"id": 122,
"labels": ["GraphGridResource"],
"enver": 0,
"createdAt": "2022-09-09T15:42:11.951Z",
"updatedAt": "2022-09-09T15:42:11.951Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:imageformat:5KVEqJrogqVUBt4S7Ebs1dGN652GdpNOAxCGweHSkFMw",
"format": "MEDIUM",
"width": 360,
"height": 360,
"originalUrl": "http://localhost/1.0/files/download?grns=grn:gg:file:cMuuifdsrcfsuJmpOYUaK9PAud6pkAyCbZJhQ8BQFIB7®ion=us-west-2&expiration=300",
"md5": ">�\u000b\u000bHdvh�q��I�",
"url": "http://localhost/1.0/files/download?grns=grn:gg:imageformat:5KVEqJrogqVUBt4S7Ebs1dGN652GdpNOAxCGweHSkFMw®ion=us-west-2&expiration=300",
"grnType": "imageformat",
"label": "ImageFormat"
},
"largeImageFormat": {
"id": 23,
"labels": ["GraphGridResource"],
"enver": 0,
"createdAt": "2022-09-09T15:42:12.254Z",
"updatedAt": "2022-09-09T15:42:12.254Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:imageformat:S0T0Ij5ZGLFFCnsf4XoJ04vXVD6W8U45dLi4vUCjZ5X5",
"format": "LARGE",
"width": 720,
"height": 720,
"originalUrl": "http://localhost/1.0/files/download?grns=grn:gg:file:cMuuifdsrcfsuJmpOYUaK9PAud6pkAyCbZJhQ8BQFIB7®ion=us-west-2&expiration=300",
"md5": "�g\\���1kd\u000b�l7�",
"url": "http://localhost/1.0/files/download?grns=grn:gg:imageformat:S0T0Ij5ZGLFFCnsf4XoJ04vXVD6W8U45dLi4vUCjZ5X5®ion=us-west-2&expiration=300",
"grnType": "imageformat",
"label": "ImageFormat"
},
"extension": "png",
"grnType": "file",
"label": "File"
}
Download file in ONgDB to MinIO
Downloads a file in ONgDB by the file grn
to MinIO
- BaseURL:
/1.0/file/download?grns={{fileGrn}}®ion={{awsRegion}}&expiration={{timeoutNum}}
- Method: POST
curl --location --request POST "${API_BASE}/1.0/file/download?grns=grn:gg:file:cMuuifdsrcfsuJmpOYUaK9PAud6pkAyCbZJhQ8BQFIB7®ion=us-east-1&expiration=300" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"bucket": "graphgrid-files-public",
"key": "test",
"duration": "1h30m30s"
}'
Response
{
"grn:gg:file:cMuuifdsrcfsuJmpOYUaK9PAud6pkAyCbZJhQ8BQFIB7": "http://minio:9000/graphgrid-files-private/test/a0a009e52f9fef08980a4a3df2ed83cd48c5f4cc3b4da21eb0d1b9676aaf7413/10_10.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minio%2F20220914%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220914T151449Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=8765e4b32f1a4829a0411112c7f0487b74d4f58887ea2ae427575abcd95d3ef"
}