Open narutaro opened 1 year ago
Hi @narutaro thanks for reaching out. Here is the AWS CLI documentation on client-side filtering for reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html#cli-usage-filter-client-side
I think what you're describing is the expected behavior, as the GetThingShadow API only returns an HTTP 200 response if successful. For commands that return data you can output the --query
filter results like this:
aws ec2 describe-instances --query 'Reservations[].Instances[].InstanceId' > instances-ids.json
Updated the issue title from --filter
to --query
Hi @tim-finnigan thank you for your comment. I understand that GetThingShadow API returns payload which is only HTTP state - 200 in my case.
Response Elements If the action is successful, the service sends back an HTTP 200 response. The response returns the following as the HTTP body. payload The state information, in JSON format.
On the other hand, I can get the whole shadow document with the command I wrote before:
aws iot-data get-thing-shadow --thing-name 8277faad --query "state" out.json
Is there a reason that the GetThingShadow API does not return shadow document as return data? (like other APIs do?)
If this is the expected behaviour due to that the API only returns HTTP 2000, should the --query
option really be available for this CLI command? At least to me it was very confusing when trying to understand why it didn't do anything. Perhaps at least some kind of error/warning message could be printed to the console instead of only null
?
Thanks for following up and elaborating on the issue. I can see how the behavior is confusing, although I don't think making the --query
option available or not depending on the command used would be considered.
Maybe there could be some sort of error message for scenarios like this, but it seems somewhat rare that a command doesn't return anything. If others run into this issue please 👍 the issue and leave a a comment if you have additional information to share.
Describe the bug
I have a following device shadow for thing
8277faad
:I run
aws iot-data get-thing-shadow --thing-name 8277faad --query "state" out.json
but the filter does not work.Expected Behavior
The expected return is following contents in the out.json file
Current Behavior
The command returns
null
out.json is not filtered by the query. The out.json is:
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CLI version used
aws-cli/2.10.1 Python/3.9.11 Darwin/21.6.0 exe/x86_64 prompt/off
Environment details (OS name and version, etc.)
Mac