Handling "Articles"
Intro
In this tutorial we will be exploring the Article CRUD operations. To better understand the topic, we will go through the following steps:
Components of an Article
Creating an Article
Updating an Article
Deleting an Article
Components of an Article
The Article is a complex object containing other entities that exist in the Content API.
Full list of Content API Entities
Category
Author
Admin (Added by the system automatically when creating an article)
Main Media
The Article contains also simple type fields such as:
Title - Title of the articles
Strapline - Preceding text of the title
Status - Active/Inactive (This is fully configurable, the Status list of options can be anything that the client requests)
Type - Interview/Commentary (This is fully configurable, the Type list of options can be anything the client requests)
Updated at - The last update time of the article (This is automatically handled by the Content API)
Published regions - A list of regions for which the Article can be displayed in (We do not provide a region restrictions services, this must be handled by the client depending on the region set in the Article)
Published channels - N/A
Origin - N/A
Sensitive content - This is a flag that is set for the Article which helps the client control what to display and how to display it.
Adult content - This is a flag that is set for the Article which helps the client control what to display and how to display it.
Run ads - This is a flag that is set for the Article which helps the client control what to display and how to display it.
Important - This is a flag that is set for the Article which helps the client control what to display and how to display it.
Live - This is a flag that is set for the Article which helps the client control what to display and how to display it.
View counter - We provide a service which allows for the integration for view counter inside of the CMS, this requires the client to have an API which returns information about the number of views the specific article has.
Published at - The Content API provides a functionality which allows the editor to set a publish time at which the Article to become active
Published until - The Content API provides a functionality which allows the editor to set a publish time at which the Article to become inactive
Creating an Article
Minimum requirements to create an Article
If the Article does not meet the minimum requirements the Content API is going to return a validation error containing a list of the missing fieldsThe Article must have a Title
The Article must have a Category
The Article must have an Author
Article structure
The structure of the body is as follows:{ "id": "2021082611393127326", "entity_type": "article", "title": "Sample title", "subtitle": "Sample summary", "strapline": "Sample strapline", "footer": null, "body": [], "published_at": "2021-10-01T09:00:00+00:00", "published_until": "2021-10-08T03:19:40+00:00", "status": null, "type": null, "live": false, "important": false, "run_ads": true, "view_counter": 0, "custom_author": null, "image": {}, "origin": null, "adult_content": false, "sensitive_content": false, "generic": null, "urls": {}, "seo": {}, "created_at": "2021-08-26T11:39:31+00:00", "updated_at": "2021-10-28T19:39:03+00:00", "category": { "id": "2020042811475553331", "entity_type": "category", "title": "Football", "description": null, "active": true, "parent_id": null, "weight": 21, "generic": null, "subs": [], "main_media": [], }, "additional_categories": [], "authors": [ { "id": "2020111712554343121", "entity_type": "author", "name": "Test Only", "bio": null, "active": true, "default": true, "avatar_url": null, "generic": null, "created_at": "2020-11-17T12:55:43+00:00", "updated_at": "2021-10-28T19:38:16+00:00", "weight": 4, "created_by": { "id": null, "full_name": null } } ], "main_media": [], "created_by": { "id": "2021072614594259878", "full_name": "Petar Stoyanov" }, "published_regions": [], "published_channels": [] }
We are going to go through the main fields of the article that will help with the rendering on the client side.
body: []
The body is the filling of the article, it contains different types of blocks which can be viewed here. Each block is an item in the body array.
main_media: []
The main_media is the article cover, this can be a
1. Video which has been created in the system
2. Gallery which has been created in the system
3. Image which has been uploaded in the system - To view additional information on how to upload an image please follow this tutorial.
4. An embeded video
For a list of Article requests, please take a look at this swagger documentation: https://docs.api.sportal365.com/?urls.primaryName=Content%20API#/Articles