How to search by slug and old slug in single API

I need to search for wordpress posts with input slug or old slug only 1 parameter in single API.

Now I'm using 2 url:

1. /wp-json/wp/v2/posts?slug=hello-world
2. /wp-json/wp/v2/posts?meta_key=_wp_old_slugmeta_value=hello-world

How can I solve this problem?

Wordpress version: 5.9

Topic rest-api wp-query slug api Wordpress search

Category Web

About

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