Pull in posts using post meta for REST API

So I wasn't able to find much detail about this, so I wanted to ask the community to see if I can get an answer.

So let's say that I have the following:

$this-global_endpoint = 'https://example.com/wp-json/global/v1/posts` which is the REST API endpoint for pulling in posts for WordPress.

Then I am calling wp_remote_request such as this:

$response = wp_remote_request(add_query_arg( [
    'page' = 1,
    'per_page' = 3,
    'post_status' = 'publish',
], $this-global_endpoint));

Does anyone know if it's possible to get a REST API return of posts based on just the post_meta?

So let's say that I want /wp-json/global/v1/posts to just return all posts if they have a post_meta key of _global_posts with the meta_value true.. is this possible?

All help will be appreciated!

Topic rest-api api query-posts posts Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.