Search…
API Reference
Resources
Retrieve an attachment
How to fetch a specific attachment via API
To fetch a single attachment, send a GET request to the /api/attachments/:id endpoint, where id is the ID of the resource that you want to retrieve.

Request

GET https://yourdomain.commercelayer.io/api/attachments/:id

Example

Request
Response
The following request fetches the attachment identified by the id "xYZkjABcde":
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/attachments/xYZkjABcde' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token'
Copied!
On success, the API responds with a 200 OK status code, returning a single resource object:
1
{
2
"data": {
3
"id": "xYZkjABcde",
4
"type": "attachments",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/attachments/xYZkjABcde"
7
},
8
"attributes": {
9
"name": "DDT transport document",
10
"description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
11
"url": "https://s3.yourdomain.com/attachment.pdf",
12
"created_at": "2018-01-01T12:00:00.000Z",
13
"updated_at": "2018-01-01T12:00:00.000Z",
14
"reference": "ANY-EXTERNAL-REFEFERNCE",
15
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
16
"metadata": {
17
"foo": "bar"
18
}
19
},
20
"relationships": {
21
"attachable": {
22
"links": {
23
"self": "https://yourdomain.commercelayer.io/api/attachments/xYZkjABcde/relationships/attachable",
24
"related": "https://yourdomain.commercelayer.io/api/attachments/xYZkjABcde/attachable"
25
}
26
}
27
},
28
"meta": {
29
"mode": "test"
30
}
31
}
32
}
Copied!
Last modified 2mo ago
Copy link