You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been testing API calls to Intersight using the intersight_rest_api module, and I have encountered a problem with the $filter Query Parameter, specifically when using the in Operator. According to the API documentation, the $filter Query Parameter can filter results based on the presence of a field value in a list of possible values, like this:
$filter=Name in ('hostname1', 'hostname2', 'hostname3')
I have tested this syntax using the Intersight API Docs Swagger UI and it definitely works as expected. Using the asset/Targets API endpoint, I can provide a list of possible hostnames in the format above, contained in parenthesis with each element surrounded by single quotes, and the API response will contain only those Targets included in my search query.
When attempting this using the Intersight Ansible Collection, I'm finding that only the first search element is recognized and passed to the API Endpoint - I only get one search result back from each API call. I have tried several methods of formatting this $filter string, including escaping the single quotes and the parenthesis, but I have been unable to get a successful result from the module.
I don't know where exactly the problem is occurring, but it seems like a string formatting issue in the Collection code itself, or some quirk in Ansible. Please look into this and determine if it can be fixed or a workaround put in place. Thank you!
The text was updated successfully, but these errors were encountered:
By default the intersight_rest_api module only returns a single result based on the query_params. The return_list parameter can be used to get all results from the API call. Here's an example that's working in my environment:
I have been testing API calls to Intersight using the
intersight_rest_api
module, and I have encountered a problem with the$filter
Query Parameter, specifically when using thein
Operator. According to the API documentation, the$filter
Query Parameter can filter results based on the presence of a field value in a list of possible values, like this:I have tested this syntax using the Intersight API Docs Swagger UI and it definitely works as expected. Using the
asset/Targets
API endpoint, I can provide a list of possible hostnames in the format above, contained in parenthesis with each element surrounded by single quotes, and the API response will contain only those Targets included in my search query.When attempting this using the Intersight Ansible Collection, I'm finding that only the first search element is recognized and passed to the API Endpoint - I only get one search result back from each API call. I have tried several methods of formatting this
$filter
string, including escaping the single quotes and the parenthesis, but I have been unable to get a successful result from the module.Environment Information:
Example Task:
Response:
Example Response from API Docs Swagger UI:
I don't know where exactly the problem is occurring, but it seems like a string formatting issue in the Collection code itself, or some quirk in Ansible. Please look into this and determine if it can be fixed or a workaround put in place. Thank you!
The text was updated successfully, but these errors were encountered: