node-wpapi icon indicating copy to clipboard operation
node-wpapi copied to clipboard

Custom Routes Issue, stuck, dynamic properties

Open bryansammon opened this issue 6 years ago • 0 comments

Ive been working on this for a while now but just cannot get it to to work:

In my plugin I have a route: register_rest_route( 'my-plugin/v1', '/(?P<requestType>\w+)/(?P<requestId>\d+)', [ settings ]);

In my node app I have:

      var site = new WPAPI({
        auth: true,
        endpoint: 'http://domain.com/wp-json',
        username: 'username',
        password: 'pass',
      });

      site.myRoute = site.registerRoute(
        'my-plugin/v1',
        '/(?P<requestType>\\w+)/(?P<requestId>\\d+)'
      );

     site.myRoute().requestType('User').requestId(5).get();

Using "wpapi": "^1.2.1"

Any idea what I am doing wrong?

bryansammon avatar Oct 13 '19 15:10 bryansammon