Category

How to Create a Ticket with an Attachment via API in Power Automate

Updated:

This article explains how to create a ticket with file attachments in BoldDesk using the REST API within Microsoft Power Automate. The process involves uploading the file, retrieving the attachment token, and then using that token when creating the ticket.

Prerequisites

Before you begin, ensure that you have:

  • A BoldDesk account with API access.
  • A valid API key.
  • A Power Automate flow.
  • The file content available in Power Automate.
  • Permission to create tickets through the REST API.

Workflow Overview

The following flow demonstrates the complete process of creating a ticket with an attachment:

Summary.png

1. Retrieve the File Content

Obtain the file content that will be uploaded as an attachment.

File_Input.png

2. Initialize a Variable

Create a variable to store the attachment token returned by the upload API response.

Declaration_var.png

3. Upload the File Using the API

Use the Upload Attachment API to upload the file and generate an attachment token.

Request Payload

Payload JSON Format

{
 "$content-type": "multipart/form-data",
 "$multipart": [
   {
     "body": "**File-Content_in_Bytes**",
     "headers": {
       "Content-Disposition": "form-data; name=\"uploadFiles\"; filename= **File_name**"
     }
   }
 ]
} 

Uploadfile.png

4. Parse the Upload Response

After the file is uploaded successfully, parse the API response to retrieve the attachment token.

Schema

{
   "type": "object",
   "properties": {
       "token": {
           "type": "string"
       },
       "url": {
           "type": "string"
       }
   }
}

Parse_Json.png

5. Store the Attachment Token

Assign the value from the token property to the previously initialized variable.
The attachment token is required when creating the ticket.

Set_token.png

6. Create the Ticket

Use the Create Ticket API and include the attachment token in the request body to associate the uploaded file with the ticket.

Create_Ticket.png

Frequently Asked Questions

  1. Why do I need to upload the file before creating the ticket?
    BoldDesk requires attachments to be uploaded first. The upload API returns an attachment token, which must be included in the ticket creation request.

  2. What is the attachment token?
    The attachment token is a temporary identifier returned by the Upload Attachment API. It links the uploaded file to the ticket when the ticket is created.

  3. Can I attach multiple files to a ticket?
    Yes. Upload each file separately, collect the returned attachment tokens, and include all tokens in the Create Ticket API request.

  4. What happens if the upload request fails?
    If the upload fails, no attachment token is generated, and the file cannot be associated with the ticket. Verify the API endpoint, authentication credentials, and file content before retrying.

Related Articles

  1. How to Set Up Microsoft Power Automate with BoldDesk
  2. How to Create Tickets on Scheduled Basis Using Microsoft Power Automate and Rest API
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied
Access denied
Access denied

No articles or sections found
No articles or sections found