en
Language
  • en
  • cs
  • hu
  • de
  • fr
  • es
  • br
  • ru
  • kr
  • jp
AI translation
  • it
  • pl
  • tr

How to Upload Attachments via JSON

Introduction

This guide explains how to upload attachments to a task using the Easy8 REST API. The process involves uploading the file to receive a token and then using that token when creating or updating a task (issue) via JSON.

Target Audience

  • Administrator

Prerequisites

Before starting, ensure you have:

  • Access to Easy8 API
  • API key or valid session authentication
  • Proper project ID and permissions to create issues
  • REST client or script environment (e.g., Postman, cURL, Python, etc.)

How to Upload Attachments via JSON

Step 1: Upload a File

Use the following API endpoint:

POST /uploads.json

Headers:

Content-Type: application/octet-stream
X-Redmine-API-Key: [your_api_key]

Body: Binary content of the file

Example response:

{
  "upload": {
    "token": "7167.ed1ccdb093229ca1bd0b043618d88743"
  }
}

Save this token for the next step.

Step 2: Create a Task (Issue) with the Uploaded File

Use the following API endpoint:

POST /issues.json

Headers:

Content-Type: application/json
X-Redmine-API-Key: [your_api_key]

JSON Body Example:

{
  "issue": {
    "project_id": "1",
    "subject": "Creating an issue with a uploaded file",
    "uploads": [
      {
        "token": "7167.ed1ccdb093229ca1bd0b043618d88743",
        "filename": "image.png",
        "content_type": "image/png"
      }
    ]
  }
}

This creates a new issue in project ID 1 and attaches the uploaded file.

Step 3: Upload Multiple Files

You can repeat the upload step multiple times to get more tokens.

Create an issue with multiple uploads:

{
  "issue": {
    "project_id": "1",
    "subject": "Creating an issue with multiple files",
    "uploads": [
      {
        "token": "7167.ed1ccdb093229ca1bd0b043618d88743",
        "filename": "image1.png",
        "content_type": "image/png"
      },
      {
        "token": "7168.d595398bbb104ed3bba0eed666785cc6",
        "filename": "image2.png",
        "content_type": "image/png"
      }
    ]
  }
}

Conclusion

You’ve now learned how to upload attachments using the Easy8 API with JSON. This method allows for seamless automation of task creation with one or multiple file uploads using upload tokens.

Related Topics and Further Reading

Try Easy8 in 30 days free trial

Access all features, SSL protected, no credit card required.