Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

Upload attachment f...
 
Notifications
Clear all

Upload attachment file using API

2 Posts
2 Users
0 Reactions
477 Views
Sylvain Devidal
(@magicbuzz)
Posts: 38
Active Member
Topic starter
 
[#9999]

Hello,

I'm using the REST API to create tickets from a custom tool, and it works fine.

Now I want to add some files (logs, configuratuon files, etc.) to the created tickets.

I tried using this query :

{ "refType": "Ticket", "refId": "1234", "description": "Fichiers du mobile", "fileName": "bupreport.zip", "file": "{Convert.ToBase64String(zip)}" }

It creates an attachment, but I can't see the file, it looks like it wasn't uploaded.
I'm not sure how I should provide the file contents.
I tried encoding the file in base64 in a field "file" but it looks like to be ignored.

I tried as a multipart request too, but it fails.

var content = new MultipartFormDataContent();
content.Add(new StringContent("Ticket"), "refType");
content.Add(new StringContent(ticket.Id.ToString()), "refId");
content.Add(new StringContent("BugReport"), "description");
content.Add(new StringContent("bupreport.zip"), "fileName");
content.Add(byteArrayContent, "data", "bugreport.zip");

How can I do ?

If it's impossible, how can I upload an attachment using a regular HTTP POST request like the browser uses when we send a file from the HTML GUI?


 
Posted : 04 Dec 2025 17H59
babynus
(@babynus)
Posts: 14966
Main Contributor Admin
 

The API is not designed to upload files.


 
Posted : 12 Dec 2025 17H49
Share:

Scroll to Top