Hey all, catching back up on backlog here.
@Phil_Seeman It’s not well documented (I’ll create a follow up task to fix this) but indexing into arrays using form data is done with square brackets both for offset-based arrays (like collaborators[0]
, collaborators[1]
) and for associative arrays (using IDs). Try:
curl --request PUT -H "authorization: Bearer MY-PERSONAL-ACCESS-TOKEN"
https://app.asana.com/api/1.0/tasks/718125926216046 --data-urlencode
"custom_fields[744020393575926]=A field updated from CURL"
This is also how you can set multiple fields at once @joehanna - by sending multiple --data-urlencode
command line params with different custom fields indexed this way I was able to check that this did the right thing:
curl -v -H "Authorization: Bearer $ASANA_PERSONAL_ACCESS_TOKEN"
--request POST --data-urlencode "projects=$ASANA_SANDBOX_PROJECT"
--data-urlencode "custom_fields[166943917002516]=Some string"
--data-urlencode "custom_fields[158477440529071]=5"
https://app.asana.com/api/1.0/tasks