Can't Post to WordPress Media API

Hey, I'm trying to post to the WordPress Media API; I've looked through similar topics on here and had no luck.

I can GET, and all works fine, but when I try to post, I get this error:

I'm pretty new to Retool & APIs, so if you have a solution, please explain like I'm 5!

This issue is related to settings in your wp-config.php file. you have to define the following: define(‘ALLOW_UNFILTERED_UPLOADS’, true)

After that you are able to upload files to the wordpress media library.

Thank you! I added that but now I get a different response:

{
"code": "rest_cannot_create",
"message": "Sorry, you are not allowed to create posts as this user.",
"data": {
"status": 401
}
}

Any advice would be hugely appreciated!

Hi @TheFactNetwork, welcome to the forum! :wave:
The new error is related to authentication. Most APIs will allow anyone to do a 'GET' request to their server without authentication because it does not make any changes to their data (it's pure retrieval). For POST, PATCH, PUT, and DELETE is a different story. You most likely need an API key for the request.

Happy building! :hammer_and_pick: