Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Mafact

Pages: [1]
1
REST / HTTP / HTTPS / Curl -F parameter
« on: February 06, 2018, 04:40:53 AM »
Hi,

I'm trying to upload a file but without success...

the Curl command wich is working is

curl \
    -H "X-Software-Company: 08d09a20-1a94-4284-9305-375d46a02914" \
    -F "file=@file.xml" \
    -u <login:password> "https://sandbox-api.codabox.com/v2/peppol/licences/95c359ec-7cee-4eaa-b9ba-a6e07db22f31/upload/"

So I can connect using

   oHttp.SetRequestHeader  "Content-Type", "multipart/form-data"   

   oHttp.Login = cLogin
   oHttp.Password = cPasswd
     
   oReq.ContentType = "multipart/form-data"
   oReq.AddHeader "X-Software-Company", "08d09a20-1a94-4284-9305-375d46a02914"
   oReq.AddHeader "Content-Type", "multipart/form-data"   
   
   oReq.HttpVerb = "POST"
 
  This one seem to not work ( -d param in CURL, not -F )
   oReq.AddParam ("file","file=@file.xml")



   oResp = oHttp.PostUrlEncoded("https://sandbox-api.codabox.com/v2/peppol/licences/95c359ec-7cee-4eaa-b9ba-a6e07db22f31/upload/",oReq)

   success = oHttp.LastMethodSuccess return 1 ok

  The file is never sended !

  Any Idea ?


Pages: [1]