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 platform and external platforms or improving efficiencies. All News API specifications are listed here.
In this article, let’s look at the everyday business use cases for the News API in your organization. The following is not an exhaustive list of use cases for the News API.
Import news from an external platform to the Staffbase platform
With the Staffbase News API, you can import all the news content created in any platform you use to your Staffbase platform. Import the content to a specific news channel in the Staffbase platform and publish it immediately or schedule it to be published later.
Importing news content from an external platform to the Staffbase platform can be helpful in many cases.
For example:
- To migrate all the content created in an external platform to the Staffbase platform
- To ensure that the content is accessible to your users on both platforms
- To build sync between the two platforms and provide a seamless flow of content
For syncing content, you need to create additional middleware between the two platforms.
Prerequisites
- You have generated an API token with editorial access or higher via the Staffbase Studio.
- Ensure that the video or image content in your news content has a URL. If not, you need to upload the video or image content to the platform via Media API before proceeding with the News API. Learn more about it here.
Importing news content
- From the Staffbase Studio, obtain the channel ID for the news channel to which you want to import the news. Learn more about it here.
- Make a
POST
request to endpoint/channels/{channelID}/posts
to add a news post to the channel you want.
export CHANNEL="5db0221d0a09a219c4ce9218"export AUTH="Basic TOKEN"
curl "https://exampleapp.staffbase.com/api/channels/$CHANNEL/posts" \ -X POST \ -H "Authorization: $AUTH" \ -H "Content-Type: application/json; charset=UTF-8" \ -d '{ "contents": { "en_US": { "title": "Very nice title.", "teaser": "Some clickbait", "content": "Full HTML content." } }, "published": "true", "notificationChannels": ["email", "push"]}