-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More blob and primary image formatting
Signed-off-by: steve lasker <[email protected]>
- Loading branch information
1 parent
6aef33a
commit 766a362
Showing
3 changed files
with
70 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,20 +35,28 @@ Create the [bearer_token](/developers/developer-patterns/getting-access-tokens-u | |
|
||
### Upload a Blob | ||
|
||
- Download a file, or select another file for upload: | ||
|
||
```bash | ||
curl https://app.datatrails.ai/archivist/v2/attachments/publicassets/208c5282-750e-4302-86f8-eb751de89005/events/4161673f-efa4-4391-bf06-347edd53024e/dae5a430-7d2e-4b88-b753-c09bdcc48c33 \ | ||
-o cat.jpg | ||
``` | ||
|
||
- Identify the file to upload: | ||
|
||
```bash | ||
BLOB=./myfile.jpg | ||
BLOB_FILE=./cat.jpg | ||
``` | ||
|
||
- Upload the blob stored at /path/to/file: | ||
|
||
```bash | ||
curl -v -X POST \ | ||
curl -X POST \ | ||
-H "@$HOME/.datatrails/bearer-token.txt" \ | ||
-H "content_type=image/jpg" \ | ||
-F "file=@$BLOB" \ | ||
https://app.datatrails.ai/archivist/v1/blobs | ||
-F "file=@$BLOB_FILE" \ | ||
https://app.datatrails.ai/archivist/v1/blobs \ | ||
| jq | ||
``` | ||
|
||
The response: | ||
|
@@ -72,37 +80,21 @@ Create the [bearer_token](/developers/developer-patterns/getting-access-tokens-u | |
|
||
### Retrieve a Blob | ||
|
||
- Retrieve a specific Blob: | ||
- Capture the Blob identity from the above POST: | ||
|
||
```bash | ||
curl -v \ | ||
-H "@$HOME/.datatrails/bearer-token.txt" \ | ||
-H "content_type=image/jpg" \ | ||
--output "/path/to/file" \ | ||
https://app.datatrails.ai/archivist/v1/blobs/$BLOB_ID | ||
BLOB_ID=<blob-id> | ||
``` | ||
|
||
The response is: | ||
- Retrieve a specific Blob, downloading the `cat.jpg` file: | ||
|
||
```json | ||
{ | ||
"hash": { | ||
"alg": "SHA256", | ||
"value": "xxxxxxxxxxxxxxxxxxxxxxx" }, | ||
"identity": "blobs/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", | ||
"issuer": "local", | ||
"mime_type": "image/jpeg", | ||
"size": 81254, | ||
"subject": "[email protected]", | ||
"tenantid": "tenant/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", | ||
"timestamp_accepted": "2023-02-06T16:04:31Z", | ||
"scanned_status": "NOT_SCANNED", | ||
"scanned_bad_reason": "", | ||
"scanned_timestamp": "" | ||
} | ||
```bash | ||
curl -H "@$HOME/.datatrails/bearer-token.txt" \ | ||
-H "content_type=image/jpg" \ | ||
--output "$BLOB_FILE" \ | ||
https://app.datatrails.ai/archivist/v1/blobs/$BLOB_ID | ||
``` | ||
|
||
|
||
## Blobs OpenAPI Docs | ||
|
||
{{< openapi url="https://raw.githubusercontent.com/datatrails/datatrails-openapi/master/doc/blobsv1.swagger.json" >}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters