In general it is always better to get the information straight from the source…. but you have to think about security. Using the REST API client from a different domain will require disable CORS protections for that domain. The amount of risk related to that depends upon how tied are the domains (do they have same admins, same kind of private data and such). This should not be done lightly and requires thinking as it opens a new attack vector against the “main” site.
OTOH if the data can not be cached, it is just “stupid” to do two requests instead of one.
The right implementation is probably to “overload” the API end points on the “main” server with a different domain that do not share cookies, which will eliminate the need for CORS protection. (this obviously assumes that user authentication is not required for what you are trying to do with the API)
Related Posts:
- 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
- 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
- WP rest api v2 posts filter by ‘search’ & ‘category_name’ not working
- WP REST API V2 – Add user data to response
- 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
- Adding custom end points, No error line
- 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?
- rest_no_route on custom API endpoint wordpress
- Custom Rest Endpoint: Post/Put/Patch not working
- Can’t retrieve body params from PUT endpoint using formdata
- 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
- update_callback is not working in register_rest_field
- REST Endpoint API 404
- Allow REST API Endpoint to specific user and hide from public
- 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
- 403 error rest_’cookie_invalid_nonce’ on API Request
- Adding Amchart Interface to WordPress API
- WC REST API Error Handling
- Initializing rest endpoint issue
- 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]
- WP API users per page
- 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?
- How to update WordPress Plugins in your own maintance application?
- Extend Plugin that creates an endpoint for GET request to also accepts POST requests
- How can create a custom plugin to call my webapi after any registration or membership plugin functionality
- Rest Api WordPress
- External api call using 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
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- On the WordPress Admin section how do I link to submenu pages created for a plugin?
- Where is it better to start learning how to develop for WordPress?
- Is there any way to test if a function running only on plugin update is successfully running?
- Hook for post permalink update
- Load page template with custom content using a plugin
- How to put placeholder text in the main post input area?
- Plugin update not reflected in WordPress plugin page
- How do I alter the comment form ‘allowed tags’ text in a plugin?
- How to create database table, add data, update and delete using wpdb via plugins?
- Extending theme PHP class in plugin
- Any ideas to trigger some code after plugin update?
- WP Editor Issue in Backend
- How to test plugin update through WordPress plugin updater without tagging new release in the repo
- UWooCommerce – add cart discount programmatically?
- Remove sidebar on single page using plugin API
- When does save_post hook fire on post save/update
- Enqueuing scripts and styles in custom plugins
- Include file in plugin file
- Adding custom stylesheet into header.php using a plugin
- Developing the save function in Gutenberg blocks
- Detect change in site_url and home_url
- Reporting errors in a shortcode plugin
- How do I add a menu item to a Pods admin menu?
- Is there a way to add a link with add_post_meta?
- How to Show Category List With Corresponding Links?
- .htaccess with WordPress – create my own pretty url with parameters (above WordPress settings)
- How do I add a 5 digit ZIP code validation to a Contact7 form?
- How can we stop showing short code in create or edit post section
- Delete Plugin Options with Verify
- How to create custom frontend php page via plugin
- Translation of plugin Upload button
- Changing upload directory for plugin uploads only
- add_filter adds output in the head
- Update option hook not firing
- Anyway to prevent admin from seeing other admin’s product?
- Build a dynamic block using the default attributes
- Bulk post approval and publishing doesn’t work
- Show Admin Menu