Uploading photo using API?
!Friendica Support, I can't figure out how to upload photos to #Friendica using API, I keep getting "Error 400, no media data submitted". Can anyone point me in the right direction?
Attempt in #Python:
Attempt in #Bash:
In both cases I get "400, no media submitted" response.
Attempt in #Python:
r = requests.get(someurl)
encr = base64.b64encode(r.content)
payload = {'media':encr, 'album':'Mobile'}
r = requests.post('https://friends.deko.cloud/api/friendica/photo/create.xml', data=payload, auth=HTTPBasicAuth('user', 'password'))
Attempt in #Bash:
$ base64 /tmp/img.jpg > /tmp/img64.jpg
$ a=$(cat /tmp/img64.jpg)
$ curl -u user:password --data "album=Mobile" --data "media=$a" https://friends.deko.cloud/api/friendica/photo/create.xml
In both cases I get "400, no media submitted" response.
Hypolite Petovan
multipart/form-data
request as if it had been sent from a file input form. Also we don't base64 decode anything about the image, so I have no idea who ever successfully used that API endpoint with that misleading documentation.Alexander likes this.
Alexander
Hypolite Petovan likes this.
Hypolite Petovan