Post image or file through form-data

Hello,

Can someone help me replicate this cURL in MIT App Inventor??

curl --location 'https://hughesenterprise.workfinity.com.br/api/serviceOrders/code/287677/attachments'
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--header 'Authorization: ••••••'
--form 'file=@"/C:/Users/gdavanco/Downloads/cn.kevinkun.HttpUtil.aix"'

I tried 3 different methods, and unfortunatelly I couldn't find a solution.

Set Web1.Url to "https://hughesenterprise.workfinity.com.br/api/serviceOrders/code/287677/attachments"

Set Web1.RequestHeaders to make a list
    "Accept: application/json"
    "Authorization: Bearer your_token_here"

Call Web1.PostFile FilePicker1.File

Try this

A quick search in the community will provide this solution

Taifun

I tried, and this is the error I’m getting.

image

image

Look at the blocks the tool created, it's using post.text with an empty dict.

Do you have any other advice you could share?

Did you pick the file? What should be the accepted file path for this curl?

Use Do it to find out Filepicker.Selection

Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Yes, I picked. It seems that web.post doesn't use form-data.

It doesn't help me.

Well, if you provide a Do it result and post it here in the community, then it probably helps us to help you

Taifun

This?