I’m trying to send a POST Request with nodejs but my request fails. Does anybody have a hint?
Tried the following:
Content-Type: multipart/form-data; boundary=---------------------------48870936082676053
-----------------------------48870936082676053
Content-Disposition: form-data; name=“media”; filename="image_5.jpg"
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
base64 encoded image content
-----------------------------48870936082676053–
But the API responds with “Unknown Twitter API Error” (Status Code 400) “not recognized.”
When using media_data parameter as described in the article (cite: “Note that if you’re uploading a base64-encoded, the param name for this endpoint will be media_data rather than media, which is used for raw images.”)
Content-Type: multipart/form-data; boundary=---------------------------5757786715403199
-----------------------------5757786715403199
Content-Disposition: form-data; name=“media_data”; filename="image_5.jpg"
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
base64 encoded image
-----------------------------5757786715403199–
The API responds with “Unknown Twitter API Error” (Status Code 409) “media param has zero bytes”