Ajay Bhagchandani
Ajay Bhagchandani

Reputation: 145

Obtaining HITIds with a specific HITTypeId using AWS CLI

I'm using aws cli to obtain a table that contains HITId of only one particular HITTypeId.

Query:

aws mturk list-hits --output table --query 'HITs[].{"1. HITId": HITId, "2. Title": Title, "3. Status":HITStatus, "4. HITTypeID": HITTypeId}' --hit-type-id "ABCD" --endpoint-url https://mturk-requester-sandbox.us-east-1.amazonaws.com --max-results 100

Output:

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: --hit-type-id, ABCD

Bit new to AWS CLI, How to tackle this?

Also, I tried with:

aws mturk list-hits --output table --query 'HITs[?HITTypeId='ABCD'].{"1. HITId": HITId, "2. Title": Title, "3. Status":HITStatus, "4. HITTypeID": HITTypeId}' --endpoint-url https://mturk-requester-sandbox.us-east-1.amazonaws.com --max-results 100

Which certainly gave me a syntax error (Was trying to relate it to Querying on table).

Reference: https://blog.mturk.com/tutorial-managing-mturk-hits-with-the-aws-command-line-interface-56eaabb7fd4c

Upvotes: 0

Views: 74

Answers (1)

nbalas
nbalas

Reputation: 1263

It looks like you have a syntax error in your filter query. The AWS CLI uses JMESPath Specification which uses == for equality, you are using ?HITTypeId='ABCD'

Try the following command:

aws mturk list-hits --output table --query 'HITs[?HITTypeId==`ABCD`].{"1. HITId": HITId, "2. Title": Title, "3. Status":HITStatus, "4. HITTypeID": HITTypeId}' --endpoint-url https://mturk-requester-sandbox.us-east-1.amazonaws.com --max-results 100

Upvotes: 1

Related Questions