Dashboard REST API - /api/apis/search?q=sample API

How to use API search endpoint?
/api/apis/search?q=sample API

Can I use wildcards (what syntax)?
If API is tagged/category, it can’t be found by name any more.

Regards,
BK

Hi @bkomac,

Thank you for writing in.

What Dashboard version are you using?
I find I am still able to retrieve API after it is tagged/categorized

I’m using Dashboard 4.2.0. with Postgres.

Hi @bkomac ,

Thanks for being patient about this. It looks like the behaviour has changed since the introduction of postgres compatibility.

The search only ever matched the API name, it has never supported wild cards and still doesn’t. It’s more a method of retrieving an API via its name rather than it’s api_id. However it used to retrieve all the APIs with the same name. For example from a version 3.0.x dashboard.

curl -sH 'Authorization: auth-string' 'http://dashboard_v3/api/apis/search?q=api1' | jq -r .apis[].api_definition.name 
api1 #homer
api1 #fred #jim

Now each has to be URL encoded to be retrieved by name including the categories, if present. Here’s an example with dashboard v4.2.0.

curl -sH 'Authorization: auth-string' 'http://dashboard_v4/api/apis/search?q=api1%20%23fred' | jq -r .apis[].api_definition.name
api1 #fred

Can I suggest pulling all the API definitions and filtering them after retrieval?

curl -sH 'Authorization: auth-string' 'http://dashboard_v4/api/apis/' | jq '.apis[].api_definition | select(.name| contains("api"))

I hope this helps
Cheers,
Pete