Create content in Silverstripe using API

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

My employer has been contacted by one of our clients who is running Silverstripe.
The client wants us to programatically create content in their Silverstripe instance.

We have been looking into the Silverstripe API, but we have been unable to determine if what the clients wants is actually possible using the API.

Does anyone know if this is possible?

The short answer is “yes”… it’s possible.
How you implement it will depend on a number of factors such as:

  • What’s the source of the data
  • How do you need to import it, is it a one-off or a regular thing
  • Where’s the data going. Is it page data, dataobjects, content elements, etc.

I think you’ll need to get a full set of requirements together for the project and plan your approach accordingly. The underlying code should be able to handle anything you need to do once you can define it.

Source is an another system in which they created articles with text and images.
Interval will not be set, it could be every other way, multiple times on the same day etc.

I am not quite sure about the terminology for Silverstripe as we have never used it before, so precisely where it is going I cannot say at the moment.

Could you point me towards some of the right endpoints of the API?

There isn’t a ready-baked API for content population as such, that’s something you’ll need to engineer yourself. The good news is that it’s generally pretty simple due to the way that the Silverstripe code works. The core Silverstripe code is all documented in the code docs: Namespaces | SilverStripe API and in the developer docs: https://docs.silverstripe.org/en/4/

It’s hard to be any more specific about what you’re going to need really. As I say, it will depend entirely on the systems you need to support - ie. are you fetching the data, is it being pushed, what format is the data in, where does it need to go, etc.

Okay, thank you for clearing that up.

It was also our initial assesment, that this is not natively supported by Silverstripe and that we would have to build something ourselves to enable this but it is still nice to have this confirmed.

Could be worth exploring the GraphQL API as well. https://docs.silverstripe.org/en/4/developer_guides/graphql/

You might want to look at the integration docs, especially the BulkLoader class.