Skip to content

Custom routes POST Request #244

Description

@apvlv

Hi,

i've set up a custom route for creating new menu items via the WP REST API. In Postman it works flawlessly but i can't get it to work with this package. The question is how i make a POST request with a custom route? Here is my code so far:

let wp = new WPAPI({
          endpoint: 'http://xxxxxx',
          username: 'xxxxx',
          password: 'xxxxx'
      });
      wp.menuAPI = wp.registerRoute( 'wp-api-menus/v2', '/create-item/id=(?P<id>)');

      wp.menuAPI().id(4).then(function( response ) {
          console.log( response );
      });

This makes a GET request, I need POST instead...

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions