REST API - Add Artifact Request

Updated by Stefenie Stockbridge

api/v1/projects/{projectId}/artifacts

Description

Adds a single artifact to the specified project.

URL Structure

[Blueprint_URI]/api/v1/projects/{projectId}/artifacts
  • ProjectId: The ID of the project that you want to add the artifact to.

Supported Methods

Request Body

The new artifact must be defined in the body of the request. Read more about how to define an artifact in the request body.

Blueprint Result Codes

Your response may contain ResultCode and Message parameters if your request involves changes to Blueprint data.  These parameters provide detailed information about the result of your request.

  • 201 (Successfully Created)
  • 401 (Unauthorized)
    • The user does not have edit permissions for the artifact.
  • 404 (Not Found)
    • Artifact not found in the project.
    • Artifact type not found.
  • 410 (Invalid Value)
    This error can occur for a variety of reasons, such as:
    • Some of artifact properties have invalid values. (The error is on the artifact level if any artifact properties have errors.)
    • No properties are specified to be updated.
    • The property value cannot be empty.
    • Custom value and choices cannot be specified simultaneously.
    • Property does not support custom values.
    • Only single choice is allowed.
    • Specified choice value does not exist.
    • Value must be less than the maximum value.
    • Value must be greater than the minimum value.
    • Limited count of decimal places.
    • Invalid rich text property value.
    • Specified user or group does not exist.
  • 416 (Cannot Update Read-Only Property)
    • Read-only property cannot be changed.
    • ID Property cannot be updated.
  • 417 (Invalid Artifact Property Type)
    • Unsupported artifact property type.
    • Property not found.
    • The property type has been removed.
    • Image property update is not supported.
  • 420 (Incorrect Folder Structure)
    • Only the project or another folder can be the parent for the folder artifact.
  • 500 (Error)
    • A system error has occurred.

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/222996/artifacts

Request Body

<?xml version="1.0" ?> 
<Artifact xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.blueprintsys.com/blueprint/api/v1">
<ArtifactTypeId>25</ArtifactTypeId>
<Name>New Textual Requirement</Name>
<ParentId>10</ParentId>
<Properties>
<Property>
<PropertyTypeId>235658</PropertyTypeId>
<TextOrChoiceValue>Sample Description</TextOrChoiceValue>
</Property>
<Property>
<NumberValue>15</NumberValue>
<PropertyTypeId>235659</PropertyTypeId>
</Property>
</Properties>
</Artifact>

Response Body

<?xml version="1.0" ?>
<PublishResultLog xmlns="http://www.blueprintsys.com/blueprint/api/v1" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<PublishResultLogEntry>
<ArtifactId>220914</ArtifactId>
<Message>Published Successfully</Message>
<ProjectId>220870</ProjectId>
<ResultCode>200</ResultCode>
</PublishResultLogEntry>
</PublishResultLog>
JSON Example

Request URI

https://production.blueprintcloud.com/api/v1/projects/222996/artifacts

Request Body

{
"Name": "New Textual Requirement",
"ParentId": 10,
"ArtifactTypeId": 25,
"Properties": [
{
"PropertyTypeId": 235658,
"TextOrChoiceValue": "Sample Description"
},
{
"PropertyTypeId": 235659,
"NumberValue": 15.0
}
]
}

Response Body

{
"Artifact": {
"Id": 14,
"Name": "New Textual Requirement",
"ParentId": 10,
"ArtifactTypeId": 25,
"ArtifactTypeName": "Textual Requirement",
"BaseArtifactType": "TextualRequirement",
"Status": {
"IsLocked": false,
"IsReadOnly": false
},
"Properties": [
{
"PropertyTypeId": 235696,
"Name": "Created By",
"BasePropertyType": "User",
"UsersAndGroups": [
{
"Type": "User",
"Id": 267,
"DisplayName": "John Smith"
}
]
},
{
"DateValue": "2013-10-16T15:44:51.5120215Z",
"PropertyTypeId": 235698,
"Name": "Created On",
"BasePropertyType": "Date"
},
{
"PropertyTypeId": 235698,
"Name": "Last Edited By",
"BasePropertyType": "User",
"UsersAndGroups": [
{
"Type": "User",
"Id": 267,
"DisplayName": "John Smith"
}
]
},
{
"DateValue": "2013-10-16T15:44:51.5120215Z",
"PropertyTypeId": 235699,
"Name": "Last Edited On",
"BasePropertyType": "Date"
},
{
"PropertyTypeId": 235658,
"Name": "Description",
"BasePropertyType": "Text",
"TextOrChoiceValue": "Sample Description"
},
{
"PropertyTypeId": 235659,
"Name": "Level",
"BasePropertyType": "Number",
"NumberValue": 15.0
}
]
},
"Message": "Success",
"ResultCode": 201
}


How did we do?