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:

  1. Components of an Article

  2. Creating an Article

  3. Updating an Article

  4. 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

  1. Category

  2. Author

  3. Admin (Added by the system automatically when creating an article)

  4. Main Media

 

The Article contains also simple type fields such as:

  1. Title - Title of the articles

  2. Strapline - Preceding text of the title

  3. Status - Active/Inactive (This is fully configurable, the Status list of options can be anything that the client requests)

  4. Type - Interview/Commentary (This is fully configurable, the Type list of options can be anything the client requests)

  5. Updated at - The last update time of the article (This is automatically handled by the Content API)

  6. 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)

  7. Published channels - N/A

  8. Origin - N/A

  9. 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.

  10. 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.

  11. 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.

  12. Important - This is a flag that is set for the Article which helps the client control what to display and how to display it.

  13. Live - This is a flag that is set for the Article which helps the client control what to display and how to display it.

  14. 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.

  15. Published at - The Content API provides a functionality which allows the editor to set a publish time at which the Article to become active

  16. 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

  1. 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 fields

    1. The Article must have a Title

    2. The Article must have a Category

    3. The Article must have an Author

  2. 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