To anyone stumbling upon this: this is in regard to the Pushbullet API, as tagged.
Trying this for the first time.
I seem to have a good response to my Upload Request, and I'm pretty sure I have the correct Upload URL for this, but the Upload stage keeps failing on me.
Code is VB6 using an MSXML2.XMLHTTP instance for sending:
With XMLHTTP
.open "POST", UploadUrl, True
.setRequestHeader "Access-Token", AccessToken
.setRequestHeader "Content-Type", "multipart/form-data; boundary=" & ContentBoundary
.onreadystatechange = Me
.send MultipartFormBody
End With
MultipartFormBody
is a Byte array so nothing is getting transcoded into UTF-8 there. ContentBoundary
is a String generated in tandem with the body data. UploadUrl
is a String with a value returned in the immediately prior (Upload Request) response. XMLHTTP creates a Content-Length header automagically.
As far as I can see the message body is properly formatted too. When I had a flaw in the latter I got back an error message that was quite helpful in correcting it.
--PushbulletReporter_3E43228zZz82234E3{CRLF}
Content-Disposition: form-data; name="file"; filename="capture.png"{CRLF}
Content-Type: image/png{CRLF}
{CRLF}
{bytes of a PNG image}--PushbulletReporter_3E43228zZz82234E3--{CRLF}
But now I get a 500 Internal Server Error with an error message "An unhandled server error occurred."
The body is a hair under 3.5KB. I'm down to notions like... perhaps chunked encoding is required here?
Any clues? What more information might help?