Clear a Custom Date Field

Hi

I’ve been searching everywhere for this - I’m trying to run an API call to clear a custom field that has a date in it.

I.e a task has a custom field on it, type: date. And it has a date in it. But I’m wanting to remove this date, so the field is now empty.

I don’t know if I’m doing something obvious wrong. I’ve tried setting the field to NULL, null, “NULL”, “null”, “”, “1970-01-01” but I get various errors, the most often one being:

[400] date_value: DayAndDateTime should have exactly one of: date, date_time

My most recent attempt is

{
  "data": {
    "custom_fields": {
      "CUSTOMFIELDID": 
        {          
               "date": "NULL"
        }
      }
    }
}

Can anyone help?

Welcome, @Pippa_Ridley,

You’re close, but I tested and this slightly different object works:

curl --request PUT \
     --url https://app.asana.com/api/1.0/tasks/9999999999 \
     --header 'accept: application/json' \
     --header 'authorization: Bearer 1/999999999999999999999999999' \
     --header 'content-type: application/json' \
     --data '
{
  "data": {
    "custom_fields": {
      "\<gid of date field\>": "null"
    }
  }
}
'

Larry

2 Likes

Larry, thank you soooo much!! Lifesaver.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.