REST API- picture attachment handling

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
theo harsant
Posts: 16
Joined: 30 Jan 2020, 15:07

REST API- picture attachment handling

Post by theo harsant »

Hello everyone,
I am trying to create issues with the rest API (Mantis version 2.23.0/ Windows 10) and command lines through curl. It works rather well, but I would like to know the details of the attachments. I can easily add text files (see https://documenter.getpostman.com/view/ ... c11f7501f4), but I would like for my use case to be able to add pictures.

My question is: how to handle the "content" part for, say, a jpg? Or are there other arguments such as the file path?
obmsch
Posts: 26
Joined: 26 Mar 2013, 22:19

Re: REST API- picture attachment handling

Post by obmsch »

As far as the php fileinfo extension is enabled, the mime type is build-in derived from the content. Something like

Code: Select all

  { "name": "test.jpg", "content": "<base64encoded_content_of_test.jpg>" }
should work in that case.
theo harsant
Posts: 16
Joined: 30 Jan 2020, 15:07

Re: REST API- picture attachment handling

Post by theo harsant »

Thank you for your reply obmsch ! You answered exactly what I needed: I was wondering how would a picture be encoded.
Post Reply