Skip to content

Conversation

allmightyspiff
Copy link
Member

Adds --json-filter to call-api, allowing more complex filters.

./slcli -v call-api SoftLayer_Account getVirtualGuests --limit=10 --json-filter '{"virtualGuests":{"hostname": {"operation": "^= test"}}}'

Adds json parsing for parameters. If a json-looking string is passed in as a parameter, call api will try to format it properly, instead of sending a string in.

$ ./slcli -vvv call-api SoftLayer_Virtual_Guest editObject --id=98316716 '{"hostname":"test-a271e"}'

Calling: SoftLayer_Virtual_Guest::editObject(id=98316716, mask='', filter='{}', args=({'hostname': 'test-a271e'},), limit=None, offset=None))

curl -u $SL_USER:$SL_APIKEY -X POST -H "Accept: */*" -H "Accept-Encoding: gzip, deflate, compress" -d '{"parameters": [{"hostname": "test-a271e"}]}' 'https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/98316716/editObject.json'

Fixes #801

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 93.848% when pulling 66d85aa on allmightyspiff:advancedFilters into 0e06b79 on softlayer:master.

Copy link
Contributor

@ATGE ATGE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old/new filter ways are working as expected, so looks good.

Copy link
Contributor

@FernandoOjeda FernandoOjeda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is working well. Looks good too.

Copy link
Contributor

@caberos caberos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is working well, but in windows the empty space in the JSON throwing an error in format, the documentation should recommend not input empty spaces.

example:
{""virtualGuests"": {""hostname"":{""operation"\ : ""techProvide""}}}

@allmightyspiff allmightyspiff merged commit 922d486 into softlayer:master Mar 16, 2020
@allmightyspiff allmightyspiff deleted the advancedFilters branch August 31, 2020 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow advanced object filters in the slcli call-api
5 participants