Attachments
This chapter focuses on services for the attachments.
Get attachment
A GET
to /attachments/{id}
returns the attachment with the given id.
Path parameters
Parameter | Description |
---|---|
|
the id of the attachment |
HTTP request
GET /api/rest/latest/attachments/3 HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 374
{
"_type" : "attachment",
"id" : 3,
"name" : "sample attachment",
"size" : 413168,
"file_type" : "pdf",
"added_on" : "2018-06-15T10:00:00.000+00:00",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/attachments/3"
},
"content" : {
"href" : "http://localhost:8080/api/rest/latest/attachments/3/content"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the attachment |
|
|
the type of the entity |
|
|
the name of the attachment |
|
|
the file type of the attachment |
|
|
the size of the attachment |
|
|
the date this attachment was uploaded |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this attachment |
|
link to download this attachment |
Rename attachment
A PATCH
to /attachments/{id}
with new name in request parameters renames the attachment with the given id.
Path parameters
Parameter | Description |
---|---|
|
the id of the attachment |
HTTP request
PATCH /api/rest/latest/attachments/3 HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
the new name for this attachment |
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 383
{
"_type" : "attachment",
"id" : 3,
"name" : "same stuff with a new name",
"size" : 413168,
"file_type" : "pdf",
"added_on" : "2018-06-15T10:00:00.000+00:00",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/attachments/3"
},
"content" : {
"href" : "http://localhost:8080/api/rest/latest/attachments/3/content"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the attachment |
|
|
the type of the entity |
|
|
the name of the attachment |
|
|
the file type of the attachment |
|
|
the size of the attachment |
|
|
the date this attachment was uploaded |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this attachment |
|
link to download this attachment |
Download attachment
A GET
to /attachments/{id}/content
downloads the attachment with the given id.
Path parameters
Parameter | Description |
---|---|
|
the id of the attachment |
HTTP request
GET /api/rest/latest/attachments/3/content HTTP/1.1
Content-Type: application/json
Accept: application/octet-stream
Host: localhost:8080
Upload attachment
A POST
to /api/rest/latest/{owner}/{ownerId}/attachments/
uploads attachments in request body to the owner with the given id. The key of these attachments should always named as "files"
.
The possible {owners}
are campaigns
, campaign-folders
, executions
, execution-steps
, iterations
, projects
,
requirement-folders
, requirement-versions
, test-cases
, test-case-folders
, test-steps
, test-suites
Path parameters
Parameter | Description |
---|---|
|
the owner of the attachment |
|
the id of the owner |
HTTP request
POST /api/rest/latest/campaigns/1/attachments HTTP/1.1
Content-Type: multipart/form-data; boundary=6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
Accept: application/json
Host: localhost:8080
--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
Content-Disposition: form-data; name=files; filename=new attachment 1.docx
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
something right
--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
Content-Disposition: form-data; name=files; filename=new attachment 2.pdf
Content-Type: application/pdf
even more
--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm--
HTTP response
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 541
{
"_embedded" : {
"attachments" : [ {
"_type" : "attachment",
"id" : 5,
"name" : "new attachment 1",
"file_type" : "docx",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/attachments/5"
}
}
}, {
"_type" : "attachment",
"id" : 6,
"name" : "new attachment 2",
"file_type" : "pdf",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/attachments/6"
}
}
} ]
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the attachments just uploaded |
Delete attachment
A DELETE
to /api/rest/latest/{owner}/{ownerId}/attachments/
with attachmentIds in request parameters removes these attachments from their owner with the given id.
The possible {owners}
are campaigns
, campaign-folders
, executions
, execution-steps
, iterations
, projects
,
requirement-folders
, requirement-versions
, test-cases
, test-case-folders
, test-steps
, test-suites
Path parameters
Parameter | Description |
---|---|
|
the owner of the attachment |
|
the id of the owner |
HTTP request
DELETE /api/rest/latest/campaigns/1/attachments?attachmentIds=7,8,9 HTTP/1.1
Content-Type: multipart/form-data
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
the ids of the attachments to delete |