Same site
As commented by Fränk request the same site it is better to use
$request = new WP_REST_Request( 'GET', '/wcfmmp/v1/orders/' );
$response = rest_do_request( $request );
var_dump( $response->get_data() );
Remote WP site
A great answer is written here for question How do I correctly setup an AJAX nonce for WordPress REST API?
Querying a remote site needs Application password as described in Application Passwords: Integration Guide
When developing locally make sure to set define('WP_ENVIRONMENT_TYPE', 'local');
curl
This will fail as the user
and application password
is not known on given site.
USER=admin
APP_PASS="abcd EFGH 1234 ijkl MNOP 6789"
BASE64=`echo $USER:$APP_PASS | base64`
curl \
--header "Accept: application/json" \
--header "Authorization: Basic $BASE64" \
https://wordpress.org/wp-json/wp/v2/
Related Posts:
- WP REST API V2 – Add user data to response
- Adding custom end points, No error line
- rest_no_route on custom API endpoint wordpress
- update_callback is not working in register_rest_field
- Allow REST API Endpoint to specific user and hide from public
- Adding Amchart Interface to WordPress API
- WP API users per page
- How to update WordPress Plugins in your own maintance application?
- External api call using wordpress
- How to check WordPress website username and password is correct
- WordPress REST API call generates nonce twice on every call
- How to: Rest endpoint returning empty object
- Custom endpoint that returns an xml
- Add Products to Woocommerce through WP API
- Plugin Sidebar is not Saving Meta Attribute to Post/Page after “Update”
- Rest Api How to get results of child categories with one api call
- wordpress custom endpoint multiple params
- WP rest api v2 posts filter by ‘search’ & ‘category_name’ not working
- What method to use to call a REST API?
- How can I pass get_the_author_meta(‘user_email’) through the REST API?
- How to get results of subcategories also?(WP Rest Api v2)
- Amending REST API function without deactivate/activate plugin every time changes is made
- Create a new post using rest api and save featured image using an external image url
- Serve text/html from wp-json API via WPEngine, headers not being set properly
- Secure REST with nonce works only when not logged
- How to do POST request with WP REST API v2 to custom table?
- Custom Rest Endpoint: Post/Put/Patch not working
- Can’t retrieve body params from PUT endpoint using formdata
- How to create WordPress custom end point with multiple parameters?
- Do I need to create an endpoint?
- WordPress Rest API with rest_do_request, possible race condition?
- How to use apiFetch to get author information in Gutenberg properly?
- Mock a dependency of a WP_REST_Controller class
- REST Endpoint API 404
- Flatten Responses returned via WP REST API via WP_Error for obfuscation
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- How to do admin ajax request in a plugin for rest api
- Attaching Image-file to userId
- Query String Filtering API
- Custom plugin & calling REST api of wordpress instance the plugins is running on
- GET request return value as error instead of success
- How to query a nested field in wordpress api using _fields param
- Get Custom taxonomy parent with wordpress REST API
- register_meta not showing custom post type metabox data in rest api
- why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function
- Securing custom rest API endpoints with public access from PWA
- WP_Query not ordering correctly
- WC REST API Error Handling
- Initializing rest endpoint issue
- Hiding WordPress REST endpoints from public viewing using Basic Authentication
- Multisite and the JSON REST API: How to?
- React in plugins: REST endpoints vs. regular functions
- Query only title/field/featured media of posts [closed]
- Best place to keep files that are called by cron jobs?
- Is it safe to use PUT and DELETE requests
- Is it possible to make WordPress as a RESTful app?
- oneOf two possible objects in WP REST API?
- Extend Plugin that creates an endpoint for GET request to also accepts POST requests
- How can I create a custom plugin to call webapi after user registration?
- How can create a custom plugin to call my webapi after any registration or membership plugin functionality
- Rest Api WordPress
- Does WP REST API cache internally executed (rest_do_request) requests?
- Run different permission_callback depending on HTTP method of custom REST API endpoint
- REST API error in block editor for custom templates
- How to get locale within WP REST Request?
- Execute callback after REST API request completes + Response is sent
- How to boost WP custom post REST API GET queries by custom taxonomies
- What’s the difference between hooks, filters and actions? [duplicate]
- update_option_{$option} Too Few Arguments
- How to post form in ajax mode and handle it in wordpress
- How to add Font Awesome 5 icons in WP Admin dashboard menu?
- Are we allowed to use the Allman (BSD) indent style when coding WordPress plugins and themes?
- Plugin development: get_post_meta is not working [closed]
- Correct way check nonce (security) using old Options API
- Display post title from WordPress excluding a string via API
- wp_insert_category() setting the ‘cat_ID’ gives not array error
- How can I limit the amount of characters used for description in the manage categories grid?
- Woocommerce api: create product with images – bad request
- Open modal when user clicks on span in visual editor
- How to paginate a custom page template with custom database tables
- Bypass product key [closed]
- Return conditional category in load_posts_by_ajax
- About a programming language starts with [closed]
- How to Get Last ID?
- Custom Block Not Shown in Block Inserter
- How to display specific data from a custom table to logged in users with a custom role
- How to Run Plugin on Server Without Web Browser
- Filterable posts using categories
- How do I make two shortcode use the same id and increment it when I use them multiple times?
- How to CRUD from wordpress database in wordpress theme?
- Can a plugin differentiate syndication feeds from actual site views?
- Change Admin menu placement using hooks
- WordPress Beginer to Guru [duplicate]
- Correct usage of scripts with shortcodes
- Creating MP3 playlist
- How to show data on a table
- echo statement repeats
- WordPress custom link with my plugin
- Running one-off cron jobs when WP_DISABLE_CRON is true: can I hit /wp-cron.php?
- Create Unique and Customized User ID for Website Members in WordPress