How can I update with a blank date via the REST API?

Do I need to "allow NULL values" someplace?

I'm having trouble doing an upsert when I have a blank date value. I'm syncing with MySQL so it is stored there as "0000-00-00". I have a data clean up class, so I can convert it to whatever but nothing has worked (I've tried NULL, empty string, and '0000-00-00'). I always get a FIELD_INTEGRITY_EXCEPTION error.

Basically, I'm doing this in PHP, and I need to know what to return when I find either an empty or non-parseable date:

    case 'date': 
        if( $value == '0000-00-00' || strtotime($value) === false ) return NULL;
        return date("Y-m-d", strtotime($value)); break;

1 Answer 1


For the SOAP API, you need to use the fieldsToNull array. If you were using the REST API, a simple null in your JSON would have sufficed. See PHP Toolkit Example for more info.

  • You're right of course, I had a problem with my field conversion script. Thanks for the help.
    – dmgig
    Commented Jul 15, 2015 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .