1. Simone Olianti
  2. PowerBuilder
  3. Monday, 11 June 2018 13:34 PM UTC

HI there, i need to replicate this kind of request:

curl -X POST \
  https://test.entaksi.eu/api/edoc/v1/aziende/1/fatture/uploadXml \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiJ9 \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: multipart/form-data' \
  -H 'Postman-Token: cf70442b-d512-4899-9e69-9691702bcd3e' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F 'invoice=@C:\Users\Utente\Desktop\Fatturazione_Elettronica\IT01234567890_FPR01.xml'

How should i pass the "invoice" parameter with the attached filename in the body of the request?

any help would be appreciated,

tia

Accepted Answer
René Ullrich Accepted Answer Pending Moderation
  1. Monday, 11 June 2018 14:08 PM UTC
  2. PowerBuilder
  3. # Permalink

It depends on how many form parts you have.

Here is an example sends XML data in one part and another xml file in a second part:

// xml meta  data

lblob_data = blob ("--"  + ls_BOUNDARY + "~r~n" + &
                 'Content-Disposition: form-data; name="meta"' + &
                 "~r~n~r~n" + ls_xml + "~r~n", EncodingUTF8!)

// a file
lblob_data += blob ("--"  + ls_BOUNDARY + "~r~n" + &
                 'Content-Disposition: form-data; name="file"; filename="stammdaten.xml"' + &
                 "~r~nContent-Type: application/xml~r~n~r~n", EncodingUTF8!) + &
                 ablob_xml + blob ("~r~n--"  + ls_BOUNDARY + "--~r~n", EncodingUTF8!)

 

The boundary string (ls_boundary) you have to specify in the request header. It is to separate the parts of the message. So it must not be a string that is in one of the message parts.

Comment
  1. Simone Olianti
  2. Monday, 11 June 2018 14:50 PM UTC
thank you Renè, working like a charm!

  1. Helpful
There are no comments made yet.
Piero Salandin Accepted Answer Pending Moderation
  1. Thursday, 27 July 2023 09:31 AM UTC
  2. PowerBuilder
  3. # 1

Hi Simone!

I have a similar problem, and I would kindly appreciate a complete tip on uploading data with a multipart/form-data POST via HTTP Client.

Can you please post a complete mock example?

 

Thanks

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.