Skip to content

Commit 5e98379

Browse files
committed
Attachment Updates
Signed-off-by: steve lasker <stevenlasker@hotmail.com>
1 parent fbb569c commit 5e98379

4 files changed

Lines changed: 41 additions & 57 deletions

File tree

content/developers/api-reference/asset-events-api/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ In a future release, Events will be created independently from Assets.
141141
The DataTrails platform has reserved attributes starting with `arc_` to perform specific capabilities.
142142
See [Reserved Attributes](/glossary/reserved-attributes/) for more info.
143143
144-
### Event Primary Image
144+
### Asset-Event Primary Image
145145
146146
Asset-Events can use the [Blobs API](/developers/api-reference/blobs-api/) to associate a primary image in the DataTrails Application.
147147

content/developers/api-reference/assets-api/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Additional YAML examples can be found in the articles in the [Overview](/platfor
9393
}
9494
```
9595
96-
### Assets With a Primary Image
96+
### Primary Image
9797
9898
An Asset can have a primary image, displayed in the DataTrails Application.
9999
The image must first be uploaded with the [Blobs API](/developers/api-reference/blobs-api/), with the BLOB_ID, BLOB_HASH and BLOB_FILE captured for uploading the asset.

content/developers/api-reference/attachments-api/index.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,22 @@ toc: true
1414
aliases:
1515
- /docs/api-reference/attachments-api/
1616
---
17-
{{< note >}}
18-
**Note:** This page is primarily intended for developers who will be writing applications that will use DataTrails for provenance.
19-
If you are looking for a simple way to test our API you might prefer our [Postman collection](https://www.postman.com/datatrails-inc/workspace/datatrails-public/overview), the [YAML runner](/developers/yaml-reference/story-runner-components/) or the [Developers](https://app.datatrails.io) section of the web UI.
17+
The Attachments API enables attaching and querying Binary Large OBjects (BLOBs) such as documents, process artifacts and images to Assets and Events.
2018

21-
Additional YAML examples can be found in the articles in the [Overview](/platform/overview/introduction/) section.
19+
{{< note >}}
20+
Attachments apply to [Asset-Events](/developers/api-reference/asset-events-api/), and Asset-free [Events](/developers/api-reference/events-api/) (preview).
21+
There are subtle differences that are documented below.
2222
{{< /note >}}
2323

24-
The Attachments API enables attaching and querying Binary Large OBjects (BLOBs) such as documents, process artifacts and images to Assets and Events.
25-
Events can also have a primary image associated with the event, providing feedback within the DataTrails application.
26-
27-
The steps include:
24+
The steps to make an attachment include:
2825

2926
1. Uploading content to the DataTrails [Blobs API](/developers/api-reference/blobs-api/).
3027
1. Attaching the blob to an [Asset](/developers/api-reference/assets-api/) or an [Event](/developers/api-reference/events-api/)
3128
1. Querying the Attachment, through an Asset or an Event
3229

3330
### Asset-Event Attachments
3431

35-
Assets support attachments by creating an [Asset-Event](/developers/api-reference/asset-events-api/) with nested `arc_` [Reserved Attributes](/glossary/reserved-attributes/).
32+
Assets support attachments by creating an [Asset-Event](/developers/api-reference/asset-events-api/) with nested `arc_` [reserved attributes](/glossary/reserved-attributes/).
3633

3734
- `"arc_attribute_type": "arc_attachment"`
3835
- `"arc_blob_identity": "blobs/b1234567-890b"`
@@ -41,7 +38,7 @@ Assets support attachments by creating an [Asset-Event](/developers/api-referenc
4138
- `"arc_file_name": "conformance.pdf"`
4239
- `"arc_display_name": "Conformance Report"`
4340

44-
For example:
41+
Example of an Asset-event with two attachments:
4542

4643
```json
4744
{
@@ -71,36 +68,40 @@ For example:
7168
}
7269
```
7370

74-
The name of the parent attribute (`"conformance_report"`) can be any value, providing a means to name multiple attachments within a single event.
75-
The DataTrails platform evaluates `"arc_attribute_type": "arc_attachment"` to reference a DataTrails Blob based attachment.
71+
The name of the parent attribute (`"conformance_report"`) can be any value, providing a means to name multiple attachments within a single event, such as the additional `"security_report"` attachment.
7672

77-
## Attachment API Examples
73+
The DataTrails platform evaluates `"arc_attribute_type": "arc_attachment"` to reference a DataTrails [Blob](/developers/api-reference/blobs-api/) based attachment.
74+
75+
## Asset-Event Attachment API Examples
7876

7977
- Create the [bearer_token](/developers/developer-patterns/getting-access-tokens-using-app-registrations) and store in a file in a secure local directory with 0600 permissions.
8078

8179
- Upload the content of the Attachment using the [Blobs API](/developers/api-reference/blobs-api/).
8280

83-
### Attachment Variables
81+
### Asset-Event Attachment Variables
8482

8583
- To associate an existing Blob, set the `ASSET_ID`, `BLOB_ID`, `BLOB_HASH` value and `BLOB_FILE` from the [Blobs API](/developers/api-reference/blobs-api/):
8684

8785
{{< note >}}
88-
NOTE: The `ASSET_ID` dependency will be removed with [Non-asset based Events (preview)](/developers/api-reference/events-api/)
86+
The `BLOB_HASH` is required, as it creates integrity protection between the content uploaded through the Blobs API, and the integrity protected reference of the Attachment.
87+
Storing the hash in the attachment assures any tampering of the blob storage, including tampering within the DataTrails platform, would be evident.
88+
89+
When retrieving the blob, the hash retrieved should be compared to the hash of the Attachment API to assure the content has not been tampered with.
8990
{{< /note >}}
9091

9192
```bash
9293
ASSET_ID=<asset-id>
9394
BLOB_ID=<blob-id>
94-
BLOB_FILE=<file.ext>
9595
BLOB_HASH=<hash-value>
96+
BLOB_FILE=conformance.pdf
9697
```
9798

9899
Example:
99100

100101
ASSET_ID=assets/a1234567-890a
101102
BLOB_ID=blobs/b1234567-890b
102-
BLOB_FILE=conformance.pdf
103103
BLOB_HASH=h1234567h
104+
BLOB_FILE=conformance.pdf
104105

105106
### Create an Asset-Event Attachment
106107

@@ -155,14 +156,16 @@ The DataTrails platform evaluates `"arc_attribute_type": "arc_attachment"` to re
155156
"arc_display_name": "Conformance Report"
156157
},
157158
"arc_display_type": "Safety Conformance"
158-
}
159+
},
160+
"..."
161+
}
159162
```
160163
161164
### Retrieve a Specific Attachment on an Asset
162165
163166
```bash
164167
curl -H "@$HOME/.datatrails/bearer-token.txt" \
165-
https://app.datatrails.ai/archivist/v2/attachments/assets/$ASSET_ID/$ATTACHMENT_ID
168+
https://app.datatrails.ai/archivist/v2/attachments/$ASSET_ID/$ATTACHMENT_ID
166169
```
167170
168171
### Retrieve a Specific Attachment on an Event

content/developers/api-reference/blobs-api/index.md

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,20 @@ toc: true
1414
aliases:
1515
- /docs/api-reference/blobs-api/
1616
---
17-
{{< note >}}
18-
**Note:** This page is primarily intended for developers who will be writing applications that will use DataTrails for provenance.
19-
If you are looking for a simple way to test our API you might prefer our [Postman collection](https://www.postman.com/datatrails-inc/workspace/datatrails-public/overview), the [YAML runner](/developers/yaml-reference/story-runner-components/) or the [Developers](https://app.datatrails.ai) section of the web UI.
20-
21-
Additional YAML examples can be found in the articles in the [Overview](/platform/overview/introduction/) section.
22-
{{< /note >}}
23-
24-
## Blob API Examples
25-
26-
The Blobs API enables you to upload Binary Large OBjects (BLOBs) such as documents, process artifacts and images to attach to your evidence ledger.
17+
The Blobs API enables uploading Binary Large OBjects (BLOBs) such as documents, process artifacts and images, [attaching](/developers/api-reference/attachments-api/) them to [Assets](/developers/api-reference/assets-api/) and [Events (preview)](/developers/api-reference/events-api/).
2718

2819
{{< note >}}
29-
**Note:** Blobs cannot be searched or listed as a collection in their own right: they must always be associated with an Asset or Event through an Attachment Attribute and can only be downloaded by users with appropriate access rights to that Attachment.
20+
**Note:** Blobs cannot be searched or listed as a collection using the blobs resource.
21+
BLobs must be associated with an Asset or Event through an Attachment Attribute and can only be downloaded by users with appropriate access rights to that Attachment.
3022
Take note of the Blob ID returned in the API response, it will be needed for use with Assets and Events.<br>
3123
For information on Attachments and how to implement them, please refer to [the Events API Reference](../events-api/#adding-attachments).
3224
{{< /note >}}
3325

34-
Create the [bearer_token](/developers/developer-patterns/getting-access-tokens-using-app-registrations) and store in a file in a secure local directory with 0600 permissions.
26+
## Blob API Examples
27+
28+
- Create the [bearer_token](/developers/developer-patterns/getting-access-tokens-using-app-registrations) and store in a file in a secure local directory with 0600 permissions.
3529

36-
### Sample Attachment
30+
### Reference a Sample File
3731

3832
An attachment can be any type of file, from media files to code files.
3933
The sample uses Fyodor (cat.jpg), but the `BLOB_FILE` can be replaced with any content you desire:
@@ -53,7 +47,7 @@ The sample uses Fyodor (cat.jpg), but the `BLOB_FILE` can be replaced with any c
5347
BLOB_FILE=./cat.jpg
5448
```
5549

56-
- Upload the blob stored at /path/to/file:
50+
- Upload the blob:
5751

5852
```bash
5953
curl -X POST \
@@ -70,24 +64,24 @@ The sample uses Fyodor (cat.jpg), but the `BLOB_FILE` can be replaced with any c
7064
{
7165
"hash": {
7266
"alg": "SHA256",
73-
"value": "h123456"
67+
"value": "h1234567h"
7468
},
75-
"identity": "blobs/b123467-8901",
69+
"identity": "blobs/b123467-890b",
7670
"mime_type": "image/jpeg",
7771
"size": 21779,
78-
"tenantid": "t1234567-8901-xxxx-xxxx-xxxxxxxxxxxx",
72+
"tenantid": "t1234567-890t",
7973
"timestamp_accepted": "2025-01-27T23:45:29Z"
8074
}
8175
```
8276

8377
### Retrieve a Blob
8478

8579
- Capture the Blob identity from the above POST.
86-
Note, the `<blob-id>` combines `blobs/` and the ID
87-
example:`"identity": "blobs/b123467-8901"` becomes `BLOB_ID=blobs/b123467-8901`:
80+
Note, the `<blob-id>` combines `blobs/` and the value.
81+
example:`"identity": "blobs/b123467-890b"` becomes `BLOB_ID=blobs/b123467-890b`:
8882

8983
```bash
90-
BLOB_ID=<blob-id>
84+
BLOB_ID=blobs/<blob-id>
9185
```
9286

9387
- Retrieve a specific Blob, downloading the `cat.jpg` file:
@@ -102,22 +96,9 @@ The sample uses Fyodor (cat.jpg), but the `BLOB_FILE` can be replaced with any c
10296
### Finding Blobs
10397

10498
The Blobs API does not support a discovery or query API that lists all possible blobs.
105-
Blobs are discovered through their usage within the DataTrails platform, such as the [Attachments API](/developers/api-reference/attachments-api/) or the primary image of an Asset or Event.
106-
Through the Attachments API, capture the value of the `"arc_blob_identity"`, nested below a named attribute with an `"arc_attribute_type": "arc_attachment"`:
107-
108-
```json
109-
{
110-
"event_attributes": {
111-
"conformance_report": {
112-
"arc_attribute_type": "arc_attachment",
113-
"arc_blob_identity": "blobs/b123456-7890",
114-
"arc_blob_hash_value": "h123456",
115-
"arc_blob_hash_alg": "SHA256",
116-
"arc_file_name": "Conformance.pdf"
117-
}
118-
}
119-
}
120-
```
99+
Blobs are discovered through their usage within the DataTrails platform, such as the [Attachments API](/developers/api-reference/attachments-api/) or the [Asset Primary Image](/developers/api-reference/assets-api/#primary-image), [Asset-event Primary Image](/developers/api-reference/asset-events-api/#asset-event-primary-image), or the [Event (preview) Primary Image](/developers/api-reference/events-api/#event-primary-image).
100+
101+
Through the above APIs, capture the value of the `"arc_blob_identity"`, nested below a named attribute with an `"arc_attribute_type": "arc_attachment"`, then use the [Attachments API](/developers/api-reference/attachments-api/) to get metadata about the attachment.
121102

122103
## Blobs OpenAPI Docs
123104

0 commit comments

Comments
 (0)