REST API - Get Attachment Request

/api/v1/projects/{projectId}/artifacts/{artifactId}/attachments/{attachmentId}

Description

Retrieves attachment content.

URL Structure

[Blueprint_URI]/api/v1/projects/{ProjectId}/artifacts/{ArtifactId}/attachments/{AttachmentId}
  • ProjectId: The ID of the project that contains the artifact with the attachment you want to retrieve.
  • ArtifactId: The ID of the artifact containing the attachment you want to retrieve.
  • AttachmentId: Defines the ID of the attachment. You can obtain an attachment ID by setting the Attachments parameter to True in any request that retrieves artifacts (example Get Artifact).

Supported Methods

HTTP Status Codes

  • 200: OK
  • 201: Successfully Created
  • 206: Partial Content
  • 400: Bad Request
    This error can occur for a variety of reasons:
    • At least one URI or request body parameter is invalid, such as one of the Filter, Traces, Offset or Limit parameters.
    • A required value has not been provided.
    • If you are submitting a POST or PATCH request and have not added the X-HTTP-Method-Override parameter to your request header.
  • 401: Unauthorized
    • The Blueprint token is missing, invalid or expired.
  • 403: Forbidden
    • The applicable permissions are needed. For example, this error can occur when:
      • An Author or Collaborate license is needed for access.
      • Comment permissions are needed on the artifact.
      • Edit permissions are needed on the change summary job.
  • 404: NotFound
    • Item is not found in the project. For example, this error can occur when:
      • Artifact not found.
      • Artifact type not found.
      • Project not found.
      • ALM target not found.
      • Change summary job not found.
      • User does not have edit permissions for this artifact, project or ALM target.
  • 409: Conflict
    • Reason for failure can be found in the response body. Additional information may also be found in the log.
  • 411: Length Required
    • If the Content-Length header is missing in the request.
  • 413: Request Entity Too Large
    • If the provided file size is larger than allowed.
  • 415: Unsupported Media Type
    • If the provided media type is not of MIME Multipart Content "form-data."
  • 416: Request Range Not Satisfiable
    • If offset points to a part of a collection that is not available.
  • 500: Internal Server Error
  • 501: Not Implemented

Examples

XML Example

Request URI

https://production.blueprintcloud.com/api/v1/projects/220870/artifacts/220914/attachments/3194?

Response Header

{'content-length': '386481', 'content-disposition': 'attachment; filename=" filename=Contract_of_Carriage.pdf"', 'expires': '-1', 'server': 'Blueprint', 'pragma': 'no-cache', 'cache-control': 'no-cache', 'date': 'Tue, 07 May 2013 17:02:01 GMT', 'content-type': 'application/octet-stream'}

Response Body

The attachment data is contained in the response body.

The response header contains important information about the attachment, such as:

  • content-length: The size of the response (that is, the attachment).
  • filename:  The name of the attachment file.
  • content-type: The response content type, which is octet-stream in this case.
JSON Example

Request URI

https://production.blueprintcloud.com/api/v1/projects/220870/artifacts/220914/attachments/3194?

Response Header

{'content-length': '386481', 'content-disposition': 'attachment; filename="Contract_of_Carriage.pdf"', 'expires': '-1', 'server': 'Blueprint', 'pragma': 'no-cache', 'cache-control': 'no-cache', 'date': 'Tue, 07 May 2013 16:58:56 GMT', 'content-type': 'application/octet-stream'}

Response Body

The attachment data is contained in the response body.

The response header contains important information about the attachment, such as:

  • content-length: The size of the response (that is, the attachment).
  • filename:  The name of the attachment file.
  • content-type: The response content type, which is octet-stream in this case.