You should not GET on a POST only rest callback. The code below creates a POST call only
register_rest_route('miningRigs/v1', 'createRig', array(
'methods' => WP_REST_SERVER::CREATABLE,
'callback' => 'createMiningRig',
));
Check http://localhost/wordpress-site/wp-json/miningRigs/v1 which shows you can only POST on createRig
I just copy/paste you code + added the https://pressupinc.com/blog/2013/07/minimum-viable-wordpress-plugin/ then enabled the plugin on 4.9.5 and it works like expected on a WP 4.9.5
Related Posts:
- WordPress Rest API custom endpoint optional param
- How to stop WP API endpoint from caching?
- How to add an endpoint for my custom post type? /wp-json/wp/v2/posts is working but it didn’t in the custom post
- Using the Rewrite API to Construct a RESTful URL
- How do I cache (core) API requests?
- WP REST API only returning partial list of users
- Slow REST API calls on self-hosted WordPress [closed]
- Retrieving pages with multiple tags using REST API
- how to authenticate for the REST API from a plugin and from command line
- WordPress API – Get Drafts
- How do I use the WP REST API plugin and the OAuth Server plugin to allow for registration and login?
- How to get the attached gallery in the rest API?
- WP API : date_query parameter
- Sync posts from one WordPress site to another
- Custom route for WP-API gives “rest_no_route” value
- Get more than 10 posts in a specific category with the wordpress api
- Developing Themes with React/Angular
- curl POST work with user meta but not the custom user meta
- Implementing the wp json-rest api
- Create post with REST API in php with file_get_contents
- Can’t get POST data in API endpoint callback
- node-wpapi: how to handle authentication?
- How can I cache WordPress Rest API Response
- WordPress REST API always misses parameters – rest_missing_callback_param
- Adding rest api endpoints to an old theme
- Develop REST API using WordPress for Android app [closed]
- Why aren’t tags and categories added in post request to WP Rest API
- POST request not going through?
- Does it still make sense using json endpoint ep_mask now that there’s the new rest api? [closed]
- Calling an API to do authentication / user login
- How do I query my WordPress posts on another HTML page using the WordPress Restful API?
- body_class REST field in WP-API
- How to edit feature image with XML RPC?
- How to fix AWS SNS API end point code that cause site not to load?
- WP REST API and Access-Control-Allow-Origin
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- rest_cannot_create_user
- Periodically Query an external API on wordpress site
- Extending the API I created to return category names
- Rest WP_Error always return null
- Posting data from Ionic app to WordPress
- Expand author, tags and categories in the WordPress JSON API
- How to display parent category with first level child in REST API
- WordPress REST API Endpoint (Authors and Categories latest posts)
- Why does “if statement” has to “die()”, otherwise wont work?
- Best way to make a JSON API from WordPress?
- REST API And Error Codes – No Message
- How to login via wordpress api and get user details?
- How many users/load can the rest API handle?
- This page didn’t load Google Maps correctly. See the JavaScript console for technical details
- This page didn’t load Google Maps correctly. See the JavaScript console for technical details
- Constructing requests with URL Query String in Python
- Fetch All Posts (Including Those Using a Custom Post Type) With WordPress API
- WP REST API no longer supports filter param, so how do I get posts in a custom taxonomy?
- Is it safe to fix Access-Control-Allow-Origin (CORS origin) errors with a php header directive?
- WooCommerce: Can’t use wc_get_products for custom REST API endpoints
- External WordPress API
- get_userdata by username
- API in numbers?
- Stuck with wp_remote_post sending data to an external api on user registration
- WordPress REST API “rest_authentication_errors” doesn’t work external queries?
- Query the REST API for a Tag by slug
- Rest API Custom Endpoint with space character
- How to Increase WordPress JSON API Speed?
- WP Rest endpoint with custom post type and ACF Fields
- Integrate ZOHO Recruit API?
- How do I get the intended post type of a revision post?
- Allow logged in WordPress user to access 3rd party Laravel API via OAuth
- WP Remote Request not returning all of content via request
- How to force JWT auth for default GET endpoints of WordPress rest api?
- Limit post creation by role
- Adding Images into API
- WordPress keeps autoplaying my Youtube-Links no matter what I write
- wc_get_products() not return the images details
- WordPress REST Api: update user
- Woocommerce REST API – add filter to set maximum query per page for product brands [closed]
- [Zapier + WP Webhooks Pro]: Custom Fields get cut off at first comma or semicolon
- Images are displaying as blank images
- Integrating API in to WordPress
- How to get the post_id after you successfully create new post using xmlrpc api wp newPost?
- Rest API Paginate until all posts are imported
- How to queue API requests with PHP in WordPress?
- trigger WordPress rest any API call
- how to create JSON array [] for REST response?
- How can I display Only the first Array/Object?
- exclude particular category in api
- How to receive JSON payload from a digital device
- Adding Amchart Interface to WordPress API
- Connecting WordPress with an External API
- WordPress json rest api displaying 10 categories only
- Deleting media using the WordPress Rest API
- Creating posts, containing data from remote API
- Encrypt API key [duplicate]
- Can I get the post id when trying to make a new post using xmlrpc?
- basic wordpress api endpoint to serve a key-value dictionary
- Using WordPress.com API to retrieve featured images
- Custom WP rest api endpoint only working on non https?
- External api call using wordpress
- Login and register by API
- Woocommerce API for calling products by Category ID