Attachments endpoint

Attachments belong to a Node in a Project

When working with data for a specific Project like Issues or Attachments, make sure to define the Dradis-Project-Id HTTP header like so:

$ curl \
  -H 'Authorization: Token token="xMsNwttqN5bVNEYcrIF01s65"' \
  -H 'Dradis-Project-Id: 3' \
  https://dradis-pro.dev/pro/api/nodes/8/attachments

GET /pro/api/nodes/:node_id/attachments

Retrieves all the Attachments associated with the specific Node in your project.

Sample request:

curl \
  -H 'Authorization: Token token="hxMsNwttqN5bVNEYcrIF01s65"' \
  -H 'Dradis-Project-Id: 3' \
  http://dradis-pro.dev/pro/api/nodes/8/attachments

Result:

[
  {
    "filename": "file%201.png",
    "link": "/pro/projects/3/nodes/8/attachments/file%201.png"
  },
  {
    "filename": "file%202.csv",
    "link": "/pro/projects/3/nodes/8/attachments/file%202.csv"
  }
]
  

GET /pro/api/nodes/:node_id/attachments/:filename

Retrieves a single attachment from a Node in your project.

Sample request:

curl \
  -H 'Authorization: Token token="hxMsNwttqN5bVNEYcrIF01s65"' \
  -H 'Dradis-Project-Id: 3' \
  http://dradis-pro.dev/pro/api/nodes/8/attachments/file%201.png

Result:

{
  "filename": "file 1.png",
  "link": "/pro/projects/3/nodes/8/attachments/file%201.png"
}
  

POST /pro/api/nodes/:node_id/attachments

Creates an Attachment on the specified Node in your project. The files to be the attached must be provided in the POST using using the Content-Type: multipart/form-data.

HTTP status 201 will be returned if the creation completes successfully.

Accepted Parameter Use
files[] Pass it the files to be uploaded, as a web browser does with an input of type field. More than 1 Attachment can be created on a single request.

Sample request:

curl \
    -H 'Authorization: Token token="hxMsNwttqN5bVNEYcrIF01s65"' \
    -H 'Dradis-Project-Id: 3' \
    -H 'Content-Type: multipart/form-data' \
    -X POST \
    -F 'files[]=@/your/own/path/file 1.png' -F 'files[]=@/your/own/path/file 1.png' \
    http://dradis-pro.dev/pro/api/nodes/8/attachments

Result:

[
  {
    "filename": "file 1.png",
    "link": "/pro/projects/3/nodes/8/attachments/file%201.png"
  },
  {
    "filename": "file 1_copy-01.png",
    "link": "/pro/projects/3/nodes/8/attachments/file%201_copy-01.png"
  }
]
  

PUT /pro/api/nodes/:node_id/attachments/:filename

Renames a specific Attachment on a Node in your project. The new name to must be provided in the body as JSON.

HTTP status 200 will be returned if the update completes successfully.

Sample request:

curl \
    -H 'Authorization: Token token="hxMsNwttqN5bVNEYcrIF01s65"' \
    -H 'Dradis-Project-Id: 3' \
    -H 'Content-type: application/json' \
    -X PUT \
    -d '{"attachment":{"filename": "new_name.png" }}' \
    http://dradis-pro.dev/pro/api/nodes/8/attachments/file%201.png

Result:

{
  "filename": "new_name.png",
  "link": "/pro/projects/3/nodes/8/attachments/new_name.png"
}
  

DELETE /pro/api/node/:node_id/attachments/:filename

Deletes an Attachment from the specified Node in your project. HTTP status 200 will be returned if the deletion completes successfully.

Sample request:

curl \
  -H 'Authorization: Token token="hxMsNwttqN5bVNEYcrIF01s65"' \
  -H 'Dradis-Project-Id: 3' \
  -H 'Content-type: application/json' \
  -X DELETE \
  http://dradis-pro.dev/pro/api/nodes/8/attachments/file%201.png

Result:

{
  "message": "Resource deleted successfully"
}

Streamline InfoSec Project Delivery

Learn practical tips to reduce the overhead that drags down security assessment delivery with this 5-day course. These proven, innovative, and straightforward techniques will optimize all areas of your next engagement including:

  • Scoping
  • Scheduling
  • Project Planning
  • Delivery
  • Intra-team Collaboration
  • Reporting and much more...

Your email is kept private. We don't do the spam thing.