Skip to content

TaskAttachments

Ivan Taghavi Espinosa edited this page Aug 4, 2020 · 16 revisions

Summary

Attachments are a way of associating a Document with a Task and can be used to fufill a File Request.

Status

Operation
Retrieve an attachment
Retrieve all attachments on a task
Attach documents to a task
Delete an attachment

Operations

Retrieve an attachment

Link relations

Name Description Methods
self The URI of the Attachment. GET
parent The URI of the Task. GET
delete The URI to delete the Attachment. DELETE
document The URI to the attached Document. GET

Example

Request

GET /tasks/12345/attachments/23 HTTP/1.1
Accept: application/vnd.huddle.data+json
Authorization: OAuth2 frootymcnooty/vonbootycherooty

JSON Response

HTTP/1.1 200 OK
Content-Type: application/vnd.huddle.data+json
{
    "actors": [{
        "name": "Jimmy Snake",
        "email": "[email protected]",
        "rel": "attacher",
        "links": [
            { "rel": "self", "href": ".." },
            { "rel": "avatar", "href": "..", "type": "image/jpeg" },
            { "rel": "alternate", "href": "..", "type": "text/html" }
        ]
    }],
    "created": "Thu, 15 Sep 2016 12:38:28 GMT",
    "links": [
        { "rel": "self", "href": "..." },
        { "rel": "parent", "href": "..." },
        { "rel": "delete", "href": "..." },
        { "rel": "document", "href": "..." }
    ]
}

XML Response

HTTP/1.1 200 OK
Content-Type: application/vnd.huddle.data+xml
<attachment>
    <actor name="Peter Gibson" email="[email protected]" rel="attacher">
        <link rel="self" href="..." />
        <link rel="avatar" href="..." type="image/jpeg" />
        <link rel="alternate" href="..." type="text/html" />
    </actor>
    <created>2007-10-10T09:02:17Z</created>
    <link rel="self" href="..." />
    <link rel="parent" href="..." />
    <link rel="delete" href="..." />
    <link rel="document" href="..." />
</attachment>

Error Responses

Case Response Code Error Code
Attachment does not exist 404 Not Found AttachmentNotFound
Task does not exist 404 Not Found TaskNotFound
Task is deleted 404 Not Found TaskDeleted
User is not a member of the Workspace 403 Forbidden WorkspaceMembershipRequired
Workspace is locked 403 Forbidden WorkspaceLocked
Workspace is deleted 404 Not Found WorkspaceDeleted

Retrieve all attachments on a task

This is limited to your 500 most recent attachments.

Link relations

Name Description Methods
self The URI of the Attachments on the Task. GET
parent The URI of the Task. GET
create The URI to add an Attachment to the Task. POST

Example

Request

GET /tasks/12345/attachments HTTP/1.1
Accept: application/vnd.huddle.data+json
Authorization: OAuth2 frootymcnooty/vonbootycherooty

JSON Response

HTTP/1.1 200 OK
Content-Type: application/vnd.huddle.data+json
{
    "links": [
        { "rel": "self", "href": "..." },
        { "rel": "parent", "href": "..." },
        { "rel": "create", "href": "..." }
    ],
    "attachments": [{
        "links": [
            { "rel": "self", "href": "..." },
            ... other attachment links ...
        ],
        ... other attachment elements ...
    }]
}

XML Response

HTTP/1.1 200 OK
Content-Type: application/vnd.huddle.data+xml
<attachments>
    <link rel="self" href=".." />
    <link rel="parent" href=".." />
    <link rel="create" href=".." />
    <items>
        <attachment>
            <link rel="self" href="..." />
            ... other attachment elements ...
        </attachment>
    </items>
</attachments>
Case Response Code Error Code
Task does not exist 404 Not Found TaskNotFound
Task is deleted 404 Not Found TaskDeleted
User is not a member of the Workspace 403 Forbidden WorkspaceMembershipRequired
Workspace is locked 403 Forbidden WorkspaceLocked
Workspace is deleted 404 Not Found WorkspaceDeleted

Attach documents to a task

Example

JSON Request

POST /tasks/12345/attachments HTTP/1.1
Content-Type: application/vnd.huddle.data+json
Authorization: OAuth2 frootymcnooty/vonbootycherooty
[{
  "links":
    [{
      "href": "...",
      "rel": "document"
    }]
},{
  "links":
    [{
      "href": "...",
      "rel": "document"
    }]
}]

XML Request

POST /tasks/12345/attachments HTTP/1.1
Content-Type: application/vnd.huddle.data+xml
Authorization: OAuth2 frootymcnooty/vonbootycherooty
<attachments>
    <attachment>
        <link rel="document" href=".." />
    </attachment>
    <attachment>
        <link rel="document" href=".." />
    </attachment>
</attachments>

Response

If successful, this method will return an empty response with a Created status code and a Location header containing the URI of the Attachments collection. This response uses the standard error codes and returns standard response headers.

HTTP/1.1 201 Created
Location: /tasks/12345/attachments

Error Responses

Case Response Code Error Code
Task does not exist 404 Not Found TaskNotFound
Task is deleted 404 Not Found TaskDeleted
Not a Document URI 400 Bad Request Invalid
User is not a member of the Workspace 403 Forbidden WorkspaceMembershipRequired
Workspace is locked 403 Forbidden WorkspaceLocked
Workspace is archived 403 Forbidden WorkspaceArchived
Workspace is deleted 404 Not Found WorkspaceDeleted

Delete an attachment

Example

Request

DELETE /tasks/12345/attachments/23 HTTP/1.1
Authorization: OAuth2 frootymcnooty/vonbootycherooty

Response

If successful, this method will return an empty response with a No Content status code. This response uses the standard error codes and returns standard response headers.

HTTP/1.1 204 No Content

Error Responses

Case Response Code Error Code
Attachment does not exist 404 Not Found AttachmentNotFound
Task does not exist 404 Not Found TaskNotFound
User is not a member of the Workspace 403 Forbidden WorkspaceMembershipRequired
Workspace is locked 403 Forbidden WorkspaceLocked
Workspace is archived 403 Forbidden WorkspaceArchived
Workspace is deleted 404 Not Found WorkspaceDeleted
Classic
Clone this wiki locally