WP API Media create() required parameters

I’m trying to make a request to post / upload a new media with WP API v2 (WP 4.7.3). I’m using a Node client (https://github.com/WP-API/node-wpapi) to deal with this.

As I’m only getting errors 400 rest_upload_no_data, I’m trying to find which fields are required to perform this action.

What I’m doing:

wp.media()
        .file( uri )
        .create({
            title: 'My awesome image',
            alt_text: 'an image of something awesome',
            caption: 'This is the caption text',
            description: 'More explanatory information',
            status: 'publish'
        })
        .then(function( response ) {
          ...

I checked the docs (https://developer.wordpress.org/rest-api/reference/media/), but I can’t see which param is required or not.

Any help?

Read more here: WP API Media create() required parameters

Leave a Reply

Your email address will not be published. Required fields are marked *