Skip to main content
Commonmark migration
Source Link

#(orig: URLFetch Multipart POST fails to post Body?)

(orig: URLFetch Multipart POST fails to post Body?)

###Update 2:

Update 2:

###Update:

Update:

###Original:

Original:

#(orig: URLFetch Multipart POST fails to post Body?)

###Update 2:

###Update:

###Original:

(orig: URLFetch Multipart POST fails to post Body?)

Update 2:

Update:

Original:

Tweeted twitter.com/StackMma/status/1046369306588663808
deleted 25 characters in body
Source Link
b3m2a1
  • 47.1k
  • 3
  • 95
  • 245

So after much weeping and gnashing of teeth our Lord and Savior Mathematica deemed me worthy of figuring out (some of) what the hell was going on.

So after much weeping and gnashing of teeth our Lord and Savior Mathematica deemed me worthy of figuring out (some of) what the hell was going on.

So after much weeping and gnashing of teeth Mathematica deemed me worthy of figuring out (some of) what was going on.

added 1131 characters in body; edited title
Source Link
b3m2a1
  • 47.1k
  • 3
  • 95
  • 245

URLFetch Multipartparameters interfere with POST fails to post Body?

#(orig: URLFetch Multipart POST fails to post Body?)

###Update 2:

So after much weeping and gnashing of teeth our Lord and Savior Mathematica deemed me worthy of figuring out (some of) what the hell was going on.

It turns out the body was being passed okay (or the multipart elements were, at least, which it turns out is sufficient). I was thrown for a loop because the "Parameters" argument of URLFetch was interfering with either the "Body" or "Headers" of my post call.

As an example I was doing a Google Drive upload and it looked like:

URLFetch[apiBase?uploadType=multipart,
  "Method"->"POST",
  "Parameters"->{uploadType->"multipart","access_token"-><MY_TOKEN>},
  "MultipartElements"->{
   {"metadata","application/json"}-><METADATA_BYTES>,
   {"contentdata","text/plain"}-><CONTENTDATA_BYTES>
   }
  ]

And that "Parameters" interfered with something. By pushing the "access_token" into the "Authorization" header and removing the "Parameters" field altogether I finally got it to work.

###Update:

URLFetch Multipart POST fails to post Body?

###Update:

URLFetch parameters interfere with POST

#(orig: URLFetch Multipart POST fails to post Body?)

###Update 2:

So after much weeping and gnashing of teeth our Lord and Savior Mathematica deemed me worthy of figuring out (some of) what the hell was going on.

It turns out the body was being passed okay (or the multipart elements were, at least, which it turns out is sufficient). I was thrown for a loop because the "Parameters" argument of URLFetch was interfering with either the "Body" or "Headers" of my post call.

As an example I was doing a Google Drive upload and it looked like:

URLFetch[apiBase?uploadType=multipart,
  "Method"->"POST",
  "Parameters"->{uploadType->"multipart","access_token"-><MY_TOKEN>},
  "MultipartElements"->{
   {"metadata","application/json"}-><METADATA_BYTES>,
   {"contentdata","text/plain"}-><CONTENTDATA_BYTES>
   }
  ]

And that "Parameters" interfered with something. By pushing the "access_token" into the "Authorization" header and removing the "Parameters" field altogether I finally got it to work.

###Update:

added 1383 characters in body
Source Link
b3m2a1
  • 47.1k
  • 3
  • 95
  • 245
Loading
Source Link
b3m2a1
  • 47.1k
  • 3
  • 95
  • 245
Loading