Update Post Publication Date and Time via News API

Learn how to update a post's publication date and time using the News API.

Employee App
Front Door Intranet

The News API gives you a lot of flexibility in how you create and manage your news content. Be that for integrating news content between the Staffbase and external platforms or improving efficiencies. See the [News API specifications] (https://developers.staffbase.com/api/api-news/).

In this article, we’ll look at a common use case for updating the publication date and time of a News post.

Publication date and time of a post in Studio

Publication date and time of a post in web app

  • You have created an API token with editorial access or higher via the Staffbase Studio. Learn more.
  • You know how Staffbase API authentication works. Learn more.
  • You have the ID of the post for which you want to modify the publication date and time. Learn more .

When a post is updated, any notification settings you have previously set still apply. For example, if push notifications are enabled for a post, they are resent upon update, unless you disable them.

Make a PUT request to the endpoint /posts/{postID} to update the publication date and time.
In the request body schema, set published parameter to a date and time of your choice in UTC time in ISO 8601 format. For example, 2023-11-07T09:00:00.000Z

If you are not familiar with UTC time, you can find several online converters that allow you to translate date and time into your preferred time zone to UTC.

Additionally, if you do not want to resend notifications for the updated post, in the request body schema, set the notificationChannels parameter to null.

Terminal window
export POST="614ad94d23af1d5f9f8f5301"
export AUTH="Basic TOKEN"
curl "https://exampleapp.staffbase.com/api/posts/$POST" \
-X PUT \
-H "Authorization: $AUTH" \
-H "Content-Type: application/json; charset=UTF-8" \
-d '{
"notificationChannels": null,
"published": "2023-11-07T09:00:00.000Z"
}'

You have updated the published date and time of a post. To bulk update the published date and time of several posts, add a function to loop through all post IDs to perform your requests.