Okay, I figured it out!
First, I created a rest endpoint in PHP.
https://github.com/bbuilds/ih-top-nurses-block/blob/main/inc/rest.php#L11
The rest point has optional parameters using regex and then in the register_rest_route() callback builds a fetch URL depending on the parameters passed to the WP-REST endpoint.
It then fires to the external API wp_remote_get($fetch_url) and dumps the data into the REST endpoint.
https://github.com/bbuilds/ih-top-nurses-block/blob/main/src/edit.js#L77
Then in my block edit function, I set up the internal rest API call using apiFetch from "@wordpress/api-fetch" using a similar buildFetch API.
Related Posts:
- 404 in gutenberg autosave of a Custom Post Type with custom rest_namespace
- Editor API Endpoint or Data Store That Provides a List of Meta Fields for Post Types
- Is it possible to access the wp-admin from one instance while keeping WP_HOME pointing to the balancing url?
- Custom Endpoint API based on attribute gutenberg block
- Custom validation on publish/ update in Block Editor
- Unable to edit server side rendered block
- apiFetch() returns infinite requests
- Block editor – Too many requests for server host
- fetch more than 100 records in block editor API call
- Block editor not loading with rest api custom code
- WP Gutenberg – How to parse simple images?
- Get the email of the author of the currently being edited post in Gutenberg frontend
- meta_query with standard getEntityRecords possible?
- Using Nested Blocks With Custom Query Block
- gutenberg block – how to force update after attribute changed?
- How can I add a custom attribute to Gutenberg core blocks?
- Add additional classes to gutenberg .editor-styles-wrapper
- How to use the WordPress < LinkControl /> Component
- How to create gutenberg block using REST API independently or as headless way?
- Add PHP block template to content using wp_insert_post
- Gutenberg reusable blocks – is it possible to customise an instance?
- Gutenberg Block manipulation: Undo parse_blocks() with serialize_blocks() results in unicode issues
- How to use “getEntityRecords” for user data?
- Gutenberg: Restrict Top Level Blocks, But Not Child Blocks
- WordPress Block Variation for Gallery Columns
- How to disable alignments for block patterns?
- How to change the admin/password when using the E2E Test Utils for Gutenberg
- Get a WordPress Gutenberg Block Attribute to use it in frontend
- Rename reusable blocks shown in navigator
- Is it posible to use wp.data.select(‘core’) outside a block?
- How to troubleshoot a custom Gutenberg block error: “This block has encountered an error and cannot be previewed”
- Two Gutenberg components sharing the same Panel Body in Inspector Controls
- How to learn Gutenberg block development [closed]
- Unable to disable Gutenberg with plugin Classic Editor or Disable Gutenberg
- How to use the @wordpress/date block in the Gutenberg editor?
- Gutenberg Block Development: Trying to add custom js script to npm start command by modifying webpack.config
- Popover in a LinkControl style
- Is there any way to render the WordPress Gutenberg core/embed block in PHP by passing in the URL?
- How to use in Block Editor – react-bootstrap?
- Double container elements on custom block in editor
- How to target block variations with has_block()?
- How to add extra option to WP core gallery block?
- Getting meta in editor plugin, and event triggering issue
- Can I jump over a InnerBlocks component to target content inside with react-flickity-component?
- Use a React Component in conjunction with Blocks
- Make a custom block like default paragraph block, so that Enter starts a new block
- Custom gutenberg block not rendering with styles on frontend
- Gutenberg Block on Second Edit fails validation
- Import setAttributes() method in a separated module
- Creating Block templates with ‘core/heading’ other than level 2
- how to trigger a Gutenberg image gallery lightbox
- Remove or rename “Default” from Gutenberg typography settings
- How to put and components inside in Gutenberg block
- Wp-script package stop to work
- CheckboxControl does not visible change
- Get terms of a taxonomy using useSelect
- Get a term object using getEntityRecords
- How to import Reusable Blocks programatically?
- Remove formatting in rich text with Gutenbergs Block editor
- Setting font sizes in theme.json
- Is it possible to disable font sizes on sub blocks only?
- Get selected block every time a new block is selected in Gutenberg
- ServerSideRender not rendering in block editor, but output is in “apiFetch”
- Can you disable typography panels for just the paragraph block?
- I cant find the custom html block
- Gutenberg allow use of block, but hide it from the block picker
- Keyboard shortcut to format text as superscript or subscript
- How to add custom HTML tags in the visual mode via keyboard only?
- Add page title after first block
- How can I programmatically disable Gutenberg query block patterns?
- Is it possible to use the WordPress block directory to make my own custom blocks
- how to copy shortcode into a block?
- Gutenberg – reusable blocks that I can edit? Am I being slow?
- Do something when publish a post in Gutenberg with hook rest_after_insert_post
- Block editor: Sandbox iframe shows outdated HTML
- How to modify the HTML output of Gutenberg block? (Youtube)
- Update block once an API request returns with a value
- Gutenberg Development vs Release version?
- Using styled-components in the save() function on gutenberg
- Custom meta POST request fired twice when updating a post in Gutenberg
- block theme FSE – save changes to the theme?
- How can I avoid setTimeout and redundant getEntityRecord calls in a block editor sidebar?
- Can this react script be optimized? How to make it faster
- Possible to use a block filter (blocks.getSaveContent.extraProps) with dynamic blocks?
- Elements positioning in a custom block
- Is it possible to get rid of the wrapping divs on a block component?
- In Full-Site-Editing, edits made to the code in a template part are not showing
- How to get appender icon to appear more often for innerblock usage
- Create a block variation of list elements
- Remove ‘default’ font option from Gutenberg typography settings
- Globally update pattern styles
- Block-based navigation and multi-language plugins
- Custom Gallery Block – Uncaught TypeError: setAttributes is not a function
- how to display gutenberg editor in a view
- Gutenberg list items nesting and creating invalid content errors
- Trying to understand block alignment
- Custom Link Block with own background color
- Is it possible to pass dynamic data from a parent dynamic block to descendant dynamic block via context?
- New server, custom blocks all give “Your site doesn’t include support for the xxx block”
- Theme.json: styles.typography.FontFamily renders as default font in front end but not editor