Issue searching file names with spaces in Cloudera Navigator API

104 views Asked by At

We are having an issue trying to use the Cloudera Navigator API to retrieve information for file names that have spaces in them. We can search for these file names in the Navigator UI by wrapping the file name in quotes. But, so far, we've been unable to figure out how to do it using the API.

We've tried with the original file name:

http://navigator.url.com:7187/api/v9/entities/?query=parentPath:(/some/parent/path) AND originalName:(Prov Layout-Others.txt)

We've tried by replacing the space with "%20":

http://navigator.url.com:7187/api/v9/entities/?query=parentPath:(/some/parent/path) AND originalName:(Prov%20Layout-Others.txt)

We've tried wrapping the file name in quotes within the URL:

http://navigator.url.com:7187/api/v9/entities/?query=parentPath:(/some/parent/path) AND originalName:("ProvLayout-Others.txt")

So far nothing has worked. Has anyone else run into this problem and, if so, is there a solution?

Thanks.

2

There are 2 answers

0
Mike On BEST ANSWER

Turns out the way to search for file names with spaces in them is to replace the spaces with asterisks (*) when constructing the REST API URL.

0
botengboteng On

For the v9 API, you can use +(query1) +(query2) or %2B(query1)%20%2B(query2) for multiple queries.

For the spaces you can use '%20'. If you use asterisks, it will get any character between your keywords (not just spaces). For example, 'customer*ID' will returns 'customer National ID' as well as just 'customer ID'.

This will work fine for searching "Customer ID" in description and /default/* in parent path

url:7187/?query=%2B(description%3A"Customer%20ID")%20%2B(parentPath%3A%5C%2Fdefault%5C%2F*)&facets=%7B%7D