Hello, I would like to know where and how to insert the "content" keyword or field name in my headers when using the HTML form-based method for uploading a file to the server via the API? The followings are what I am sending to PA server from an Arduino device using the client.println() function from its WiFiClientSecure library.
*POST https://www.pythonanywhere.com/api/v0/user/wee/files/path/home/wee/foo.csv/ HTTP/1.1
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxx
Host: www.pythonanywhere.com
User-Agent: Arduino/1.0
Connection: close
Content-Type: multipart/form-data; boundary=content_boundary
Content-Length: 266
--content_boundary
...content of the file sent as a series of char bytes...
--content_boundary--*
The PA server seems to have accepted the above POST request but responded with an error about "You must provide a file with the name 'content'." But I do not know where, the format, and how to insert the required keyword "content" in the headers of my HTML form.
The followings are the responses to the POST request I have received from PA server.
Read Server Response:
Set-Cookie: sessionid=vuor61h0123rzkedzdl5mjh0svnsrheb; expires=Tue, 11 Jan 2022 03:35:39 GMT; HttpOnly; Max-Age
Server: PythonAnywhereSite=None; Secure
headers received.
response: {"detail":"You must provide a file with the name 'content'."}
close connection
Adding the following Content-Disposition after --content_boundary resulted in no response from the server.
Content-Disposition: form-data; name="content"; filename="content.csv"
Content-Type: text/csv