# Articles

Manage system articles. Only admin and agents with appropriate permissions can edit and update articles.

# Article Object

Name Type Comment
id integer Unique article identifier.
title string Article title.
slug string Unique article URL friendly slug.
body string Article body.
order integer Article position within the belonging article collection.
author_id integer The ID of the article author.
category_id integer The ID of the article category to which an article belongs to.
collection_id integer The ID of the collection to which an article belongs to.
published_at datetime Article publication timestamp or null if article is not published yet.
created_at datetime Article creation timestamp.
updated_at datetime Article update timestamp.

# Paginate Articles

GET
/articles

# Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/articles' \
--header 'Accept: aplication/json'

# Example Response

{
    "data": [
      {
        "id": 9,
        "title": "My New Article",
        "slug": "my-new-article-9",
        "body": "Hello! This is my new article...",
        "order": 6,
        "author_id": 3,
        "category_id": 1,
        "collection_id": 8,
        "published_at": "2019-09-28 13:23:55",
        "created_at": "2019-09-28 13:23:55",
        "updated_at": "2019-09-28 13:23:55"
      },
      //...
    ],
    "links": {
        //...
    },
    "meta": {
        //...
    }
}

# Available includes

If provided, the available includes will be part of the response for each article object.

author

An agent who created the article.

category

A category object for the category to which the article belongs to.

collection

A collection object for the collection to which the article belongs to.

tags

An array of tags associated with the article.

# Sortable Fields

title, order (default), created_at, updated_at

# Partial filters

title, body

# Exact filters

author, category, collection

# View an Article

GET
/articles/{id}

# Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/articles/{id}' \
--header 'Accept: aplication/json'

# Example Response

{
    "data": {
     "id": 9,
     "title": "My New Article",
     "slug": "my-new-article-9",
     "body": "Hello! This is my new article...",
     "order": 6,
     "author_id": 3,
     "category_id": 1,
     "collection_id": 8,
     "published_at": "2019-09-28 13:23:55",
     "created_at": "2019-09-28 13:23:55",
     "updated_at": "2019-09-28 13:23:55"
   }
}

# Available includes

Same as for paginating the articles.

# Create an Article

POST
/articles
Parameter Type Required Validation
title string Yes Any string with length shorter or equal to 250 characters.
body string Yes
category integer Yes A valid category id.
collection integer Yes A valid collection id.
status string Yes Valid values are: draft and published.
tags array No Any tags that should be associated with the article.

# Request

curl --location --request POST 'https://yoursubdomain.support-hub.io/api/articles' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "title": "My New Article",
  "body": "Hello! This is my new article...",
  "category": 1,
  "collection": 8,
  "status": "published"
}'

# Example Response

Status: 201 Created

{
  "data": {
      "id": 9,
      "title": "My New Article",
      "slug": "my-new-article-9",
      "body": "Hello! This is my new article...",
      "order": 6,
      "author_id": 3,
      "category_id": 1,
      "collection_id": 8,
      "published_at": "2019-09-28 13:23:55",
      "created_at": "2019-09-28 13:23:55",
      "updated_at": "2019-09-28 13:23:55"
    }
}

# Update an Article

PATCH
/articles/{id}
Parameter Type Required Validation
title string Yes Any string with length shorter or equal to 250 characters.
body string Yes
category integer Yes A valid category id.
collection integer Yes A valid collection id.
status string Yes Valid values are: draft and published.
tags array No Any tags that should be associated with the article.

# Request

curl --location --request PATCH 'https://yoursubdomain.support-hub.io/api/articles/9' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "title": "My New Article"
}'

# Example Response

Status: 200 OK

{
  "data": {
      "id": 9,
      "title": "My New Article",
      "slug": "my-new-article-9",
      "body": "Hello! This is my new article...",
      "order": 6,
      "author_id": 3,
      "category_id": 1,
      "collection_id": 8,
      "published_at": "2019-09-28 13:23:55",
      "created_at": "2019-09-28 13:23:55",
      "updated_at": "2019-09-28 13:23:55"
    }
}

# Delete an Article

DELETE
/articles/{id}

# Request

curl --location --request DELETE 'https://yoursubdomain.support-hub.io/api/articles/9' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

# Example Response

Status: 200 OK

{
  "success": true
}

# Update Order

Update order for the provided list of articles.

DELETE
/articles/order
Parameter Type Required Validation Example
order array yes An associative array of order => article_id elements. [0 => 1100, 1 => 1344, 2 => 3211]

WARNING

All articles must belong to the same collection.

TIP

If you want you can omit the index inside the associative array and the order property will be updated according to the position of the article_id within the received order array.

# Request

curl --location --request POST 'https://yoursubdomain.support-hub.io/api/articles/order' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "order": [
    1100,
    1344,
    3211
  ]
}'

# Example Response

Status: 200 OK

{
  "success": true
}