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?
- REST API Plugin Update call back not updating the plugin
- 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
- What is an Endpoint?
- Constructing requests with URL Query String in Python
- Yahoo! Finance CSV file will not return Dow Jones (^DJI)
- Is there a developers api for craigslist.org
- How do you get the API key for Locu?
- Postman Resolving “Invalid CORS request” for a POST Request
- WP function/filter for modifying http headers?
- Access WordPress API Outside of WordPress (command-line PHP)
- Create API for single sign-on with 3rd party site
- Query WP REST API v2 by multiple meta keys
- Set up WP Authentication from External API
- 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 there a way to get protected meta fields through any of the available built-in WordPress APIs? (xmlrpc, wp-json)
- What is the best way to get directory path for wp-config.php?
- Why is my custom API endpoint not working?
- WordPress JSON output
- 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
- REST API endpoint for elasticpress autosuggest
- How can I get users email (and additional data) from the rest API?
- External WordPress API
- Why is per_page not working with categories in WP API?
- REST API: How can I restrict a custom post type to only be accessible by authenticated users?
- Creating a post with the REST API, curl and oauth returning 401 error
- Should I store external API data in my WP database or keep it as a transient?
- Sending POST Request from server
- How to implement ERP (Enterprise Resource Planning) into WordPress?
- List Table API – Safe to use?
- WordPress 4.7 REST API endpoints
- API integration with WordPress
- Does the REST API (official) support custom post types?
- POST to a REST API from a wordpress form
- How to: Rest endpoint returning empty object
- Gutenberg internal page link search box
- get WP-API by page id
- WordPress.org Support Forum API
- Authentication/API Questions
- register_rest_field for custom taxonomy fields that are assosiated with custom post type
- Connect external web app to wordpress
- How to force Authentication on REST API for Password protected page using custom table and fetch() without Plugin
- How to get all posts (in chunks) via XML-RPC?
- AJAX request from Chrome Extension to WordPress Website
- Custom endpoint that returns an xml
- Get post from custom REST endpoint in Gutenberg
- How to add a custom parameter to a WP API default route?
- Headless WordPress: How to authenticate front end requests?
- Passing variables to new page