/workspaces/{workspace_gid}/tasks/search won't accept additional URL parameters in CURL

Hi, I’m trying to get a list of all tasks completed by the team during a certain period. I’m using Search Tasks in a Workspace as directed by the help. I cannot seem to add any additional parameters (&param=value) and it will always give me the error “not recognized as an internal or external command, operable program or batch file.”

For example, the following query works:
curl https://app.asana.com/api/1.0/workspaces/{workspace_gid}/tasks/search?completed_on.after=2020-07-20

If I add any additional parameter it will produce an error, like:
curl https://app.asana.com/api/1.0/workspaces/{workspace_gid}/tasks/search?completed_on.after=2020-07-20&opt_fields=assignee
or:
curl https://app.asana.com/api/1.0/workspaces/{workspace_gid}/tasks/search?completed_on.after=2020-07-20&limit=10

I believe this is because the route I’m requesting is being rewritten and the additional parameter I added is not being concatenated correctly. However, I can’t find any combination of queries and parameters that will allow me to make the request I need with any additional parameters. I have been able to include multiple parameters with a simpler request (shorter path) which leads me to believe that the problem is in the routes.

This works:
curl "https://app.asana.com/api/1.0/tasks?assignee=me&limit=100&workspace={workspace_gid}&opt_fields=name%2Cassignee_status"

Unfortunately, it’s limited to requiring an assignee and project, whereas I’m trying to get all tasks completed by my team during a given period.

Hi @Ben_Graham,

To resolve this issue, put quotation marks around the whole query string. I.e. this works for me:

curl "https://app.asana.com/api/1.0/workspaces/159278241464125/tasks/search?opt_fields=assignee&completed_on.after=2020-04-20" -H "Authorization: Bearer 1/1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxd"

I’m embarassed that that was all that was missing. I assumed that because it was echoing back the name of the second field in the error response that it was receiving the full request including all parameters, but obviously something was not working that way properly. Thank you, Phil!

1 Like

No worries, @Ben_Graham - believe me, I’ve been there!