How to save attachment as file using API

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
dejski
Posts: 1
Joined: 09 Aug 2021, 09:33

How to save attachment as file using API

Post by dejski »

Hello :)
I need to get files from Mantis, and save it on disc.
When I use API with curl:
curl --insecure --location -g --request GET https://server/api/rest/issues/0000050/files/10 -H "Authorization: xxx1kKwubSYejFz5pq8ExtETo6nTnro8" --output pooh-hungry.gif

I get response like below, but is not a gif file.

Do you know how can I save attachment from Mantis as a proper file?


{
"files": [
{
"id": 10,
"reporter": {
"id": 26,
"name": "xxx",
"real_name": "xxxx",
"email": "xxx@xxx.pl"
},
"created_at": "2021-08-09T10:27:49+02:00",
"filename": "pooh-hungry.gif",
"size": 139441,
"content_type": "image/gif; charset=binary",
"content": "R0lGODlh3AC7APeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA....


Best regards
Post Reply