Skip to main content

Upload Attachments to Entities

Overview

This document outlines the process for uploading attachments to entities mentioned in a comment using SyncNow DevOps Gate APIs.

Example Scenarios

  1. Upload logs or attach a report to a security scan and a bug opened from any system.
  2. Attach a build report to an entity.

Request

The request URL should contain the system ID, which can be copied from the DevOps Process definition page.

POST /api/v1.0/app/DevOpsGate/Enrich/{DevOpsProjectID}/Attachment

The payload should be in form-data or x-www-form-urlencoded format.

ParameterDescription
commentsComment containing the entity IDs to update with #{Entity ID}, e.g., "String with updated entity keys is ready for other DevOps Gate APIs, #CLS-3933, #CLS-3938".
attachmentsA file blob with the first attachment.
attachmentsAdditional attachments can be added with the same parameter name.

Response

This is the response for the comment "String with updated entity keys is ready for other DevOps Gate APIs, #CLS-3933, #CLS-3938".

{
    "updatedEntitiesID": [
        {
            "systemID": "10",
            "entityKeys": [
                {
                    "entityKey": "CLS-3933",
                    "attachmentsID": [
                        "32013"
                    ]
                },
                {
                    "entityKey": "CLS-3938",
                    "attachmentsID": [
                        "32014"
                    ]
                }
            ]
        }
    ],
    "errors": [],
    "warnings": []
}
ParameterDescription
updatedEntitiesIDAn array of updated entities.
systemIDThe system where the entities were updated.
entityKeysThe updated entity keys, including the entity ID and the created attachment ID.
errorsErrors that occurred during the attachment process.
warningsWarnings that occurred during the attachment process.

Step-by-Step Instructions

  1. Create a DevOps Gate Process.
  2. Create two entities in the target system that should be updated by the DevOps Gate.

Create Entities

  1. Go to the DevOps Gate Process Configuration and add two allowed projects (for demonstration purposes).
  2. Press the "How It Works" link.

How It Works

  1. Select "Upload Attachments".
  2. Copy the cURL command.

Copy cURL

  1. Paste the cURL command into a command line, set the entity keys of the created entities, and execute.

Paste Into Command Line

  1. Attachments will be uploaded to all entities mentioned in the commits or by the pull request

Entity From Commits