You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/developers/api-reference/assets-api/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,7 +93,7 @@ Additional YAML examples can be found in the articles in the [Overview](/platfor
93
93
}
94
94
```
95
95
96
-
### Assets With a Primary Image
96
+
### Primary Image
97
97
98
98
An Asset can have a primary image, displayed in the DataTrails Application.
99
99
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.
Copy file name to clipboardExpand all lines: content/developers/api-reference/attachments-api/index.md
+22-19Lines changed: 22 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,25 +14,22 @@ toc: true
14
14
aliases:
15
15
- /docs/api-reference/attachments-api/
16
16
---
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.
20
18
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.
22
22
{{< /note >}}
23
23
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:
28
25
29
26
1. Uploading content to the DataTrails [Blobs API](/developers/api-reference/blobs-api/).
30
27
1. Attaching the blob to an [Asset](/developers/api-reference/assets-api/) or an [Event](/developers/api-reference/events-api/)
31
28
1. Querying the Attachment, through an Asset or an Event
32
29
33
30
### Asset-Event Attachments
34
31
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/).
36
33
37
34
-`"arc_attribute_type": "arc_attachment"`
38
35
-`"arc_blob_identity": "blobs/b1234567-890b"`
@@ -41,7 +38,7 @@ Assets support attachments by creating an [Asset-Event](/developers/api-referenc
41
38
-`"arc_file_name": "conformance.pdf"`
42
39
-`"arc_display_name": "Conformance Report"`
43
40
44
-
For example:
41
+
Example of an Asset-event with two attachments:
45
42
46
43
```json
47
44
{
@@ -71,36 +68,40 @@ For example:
71
68
}
72
69
```
73
70
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.
76
72
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
78
76
79
77
- 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.
80
78
81
79
- Upload the content of the Attachment using the [Blobs API](/developers/api-reference/blobs-api/).
82
80
83
-
### Attachment Variables
81
+
### Asset-Event Attachment Variables
84
82
85
83
- 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/):
86
84
87
85
{{< 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.
89
90
{{< /note >}}
90
91
91
92
```bash
92
93
ASSET_ID=<asset-id>
93
94
BLOB_ID=<blob-id>
94
-
BLOB_FILE=<file.ext>
95
95
BLOB_HASH=<hash-value>
96
+
BLOB_FILE=conformance.pdf
96
97
```
97
98
98
99
Example:
99
100
100
101
ASSET_ID=assets/a1234567-890a
101
102
BLOB_ID=blobs/b1234567-890b
102
-
BLOB_FILE=conformance.pdf
103
103
BLOB_HASH=h1234567h
104
+
BLOB_FILE=conformance.pdf
104
105
105
106
### Create an Asset-Event Attachment
106
107
@@ -155,14 +156,16 @@ The DataTrails platform evaluates `"arc_attribute_type": "arc_attachment"` to re
Copy file name to clipboardExpand all lines: content/developers/api-reference/blobs-api/index.md
+17-36Lines changed: 17 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,26 +14,20 @@ toc: true
14
14
aliases:
15
15
- /docs/api-reference/blobs-api/
16
16
---
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/).
27
18
28
19
{{< 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.
30
22
Take note of the Blob ID returned in the API response, it will be needed for use with Assets and Events.<br>
31
23
For information on Attachments and how to implement them, please refer to [the Events API Reference](../events-api/#adding-attachments).
32
24
{{< /note >}}
33
25
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.
35
29
36
-
### Sample Attachment
30
+
### Reference a Sample File
37
31
38
32
An attachment can be any type of file, from media files to code files.
39
33
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
53
47
BLOB_FILE=./cat.jpg
54
48
```
55
49
56
-
- Upload the blob stored at /path/to/file:
50
+
- Upload the blob:
57
51
58
52
```bash
59
53
curl -X POST \
@@ -70,24 +64,24 @@ The sample uses Fyodor (cat.jpg), but the `BLOB_FILE` can be replaced with any c
- 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
102
96
### Finding Blobs
103
97
104
98
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.
0 commit comments