NULL data in query result


I’m using the following query:
$response = $api->query(
Predicates::at(‘document.type’, ‘press_releases’),
[ ‘pageSize’ => 50, ‘page’ => 1, ‘orderings’ => ‘[my.press_releases.live_date desc]’ ]
Many of the results comes back with live_date field being NULL even though there is valid data in them. Please advise.

Hello, @lrmpham welcome to the community forum!

  • Are you checking that the endpoint is correct?
  • Is this the only query that is causing you trouble?
  • do you have more than one language in your repository that may contain Documents with an empty live_date field?

The endpoint is correct and it returns the press_releases. It is only the live_date field that is coming back as NULL. All the other fields of the press_release are coming back ok.


Did you add the live_date field after the original documents were published? If so you will have to go back a re-publish these documents to trigger the population of the field in the API.

No. Most of the press_releases documents were imported into the system. Does that make a difference ?

It shouldn’t make a difference if the date format is correct. When you check the documents in the document writing room, is the date correct there?

Yes. The date data is there and is correct.

Thank you for letting us know about your case @lrmpham.

For the moment we don’t know what the issue could be so we’re passing this over to the dev team. We’ll get back to you with an answer as soon as possible.


Hello again!

Sometimes, when doing imports, if there’s something incorrect in the fields, the data will be returned as null even if the published documents are correctly displayed. What you can do now, is go back to the documents with the Null values in the Date field, make a modification on the Date and re-publish.

So looks like that did the trick. But that means I have to go through 200+ documents and manually update the field ? That is just the press_releases documents. There are also 100+ articles documents that I imported also. Is there something you can do on your backend ?


I totally understand that this could come as a hassle if you have too many documents with the same error. But yes, for the moment this would be the only way to correct your documents.

The dev team is now informed about this matter. If we release a fix for this we will communicate it here on the forum.

If you need anything else, let us know.


I think the issue might have come when you first imported the documents, I think maybe the date field format was incorrect.

What you could try is to export all of the documents and re-import them to see if this triggers the correct date in the date field. Failing that you could export the documents and run a script which matches the UID from the original files that you imported and adds the date in the correct format, then when you do the import the date would be published correctly on all your docs.

Just to confirm, if I export the press_releases documents and re-import them, they will overwrite the documents that are in the repo and not create new ones ?

So I did an export of an article, took the json and zipped it, upload the zip to import and it gave a warning that the live_date field is not valid. Can you let me know what the date format should be ? Thanks.

You need to make sure that the format of the JSON is the correct one. For a Date field, type with an API ID of “live_date”. You need to provide a string with the date in the following format: “YYYY-MM-DD”.

If the date format is not correct, no value will be entered for the field.

"live_date": "2016-09-16"

Read the full JSON reference for importing documents using the Import module.

Same happened here with timestamp: no errors appeared when importing and all dates are correctly showing in the dashboard. Api returns null. imported +/- 400 documents, including files.