Using the API to find hosts containing a specific string in the name

The GET/hosts endpoint has a search filter, allowing you to filter by name. Is it possible to filter via a host’s name if I only know a unique part of it i.e. the hostname is “” and I want to search for the host that contains “johndoe”. Is this doable via the aforementioned endpoint, or is there some other endpoint that would fulfil this usecase? Thank you!

You can search for partial matches with ~ , so the url will look like /api/v2/hosts?search=name+~+john.