Uploading image via REST Api v2
-
[ Moved to the Developing with WordPress sub-forum. ]
Hi. Im trying to upload png image via REST Api. To be more precise Im using Python and Requests library (code below).
I use “Content-Disposition”: “attachment; filename=image.png”, and set Content-Type to “image/png” or “multipart/form-data” but then I get:{"code":"rest_upload_sideload_error","message":"Sorry, this file type is not permitted for security reasons.","data":{"status":500}}'
requests.post(url=media_url, headers=headers, auth=auth, files={
'file': open(filename, 'rb')})Have you got any ideas? I don’t see any solutions in docs.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Uploading image via REST Api v2’ is closed to new replies.