Page 1 of 1

REST API- picture attachment handling

Posted: 03 Feb 2020, 16:49
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?

Re: REST API- picture attachment handling

Posted: 04 Feb 2020, 00:05
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.

Re: REST API- picture attachment handling

Posted: 04 Feb 2020, 08:28
by theo harsant
Thank you for your reply obmsch ! You answered exactly what I needed: I was wondering how would a picture be encoded.