You are not logged in. Click here to log in.

codebeamer Application Lifecycle Management (ALM)

Search In Project

Search inClear

Tags:  not added yet

Creating a tracker item with attachments in description

Create the tracker item with all fields and with dummy description

In order to add files into description we need to attach them to the tracker item. So first we need to create the item.


Endpoint:

POST /v2/tracker/{trackerId}/item

Request body:

{
  "name": "My first tracker item",
  "description": "To update later.",
  "descriptionFormat": "Wiki" or "Html",
  "status": {
    "fieldId": 7,
    "type": "integer",
    "value": 1
  }
}

Response:

{
  "id": {trackerItemId},
  "uri": "/item/{trackerItemId}",
  "name": "My first tracker item",
  "type": "TrackerItem",
  "version": 1,
  "description": "To update later.",
...


Upload the attachments under the newly created tracker item

Endpoint:

POST /v2/item/{trackerItemId}/attachment -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "attachments=@{attachmentName};type=application/zip"

Response:

[
  {
    "id": {attachmentId},
    "uri": "/attachment/{attachmentId}",
    "version": 1,
    "name": "{attachmentName}",
    "size": 7073,
    "md5": "3061BCC57937B92F78C8A0FF233DBCE3",
    "modifiedAt": "2019-08-21T14:34:36",
    "modifier": {
      "id": 1,
      "uri": "/user/1",
      "name": "bond",
      "type": "UserReference"
    }
  }
]


Update the description based on the attachment information (Wiki)

After uploading all the attachments you can compose your description using the attachmentName-s and attachmentId-s.


Endpoint:

PUT /v2/item/{trackerItemId}/field

Request body:

{
  "fieldValues": [
    {
      "fieldId": 80,
      "type": "TextFieldValue",
      "value": "My attachment: [{attachmentName}|{baseUrl}/displayDocument/{attachmentName}?task_id={trackerItemId}&artifact_id={attachmentId}]"
    }
  ]
}

Update the description based on the attachment information (HTML)

After uploading all the attachments you can compose your description using the attachmentName-s and attachmentId-s.


Endpoint:

PUT /v2/item/{trackerItemId}/field

Request body:

{
  "fieldValues": [
    {
      "fieldId": 80,
      "type": "TextFieldValue",
      "value": "My attachment: <a href=\"{baseUrl}/displayDocument/{attachmentName}?task_id={trackerItemId}&artifact_id={attachmentId}\">{attachmentName}</a>"
    }
  ]
}