Learn how to update a post's publication date and time using the News API.
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
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.
PUT
request to the endpoint /posts/{postID}
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
.
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.