# Article Collections

Manage knowledgebase article collections. Available for admin and agents who have appropriate permissions.

# Collection Object

Name Type Comment
id integer Unique collection identifier.
category_id integer The ID of the category to which the collection belongs to.
name string Collection name.
order integer Order number that can be used to sort collections.
visibility integer The collection visibility.
created_at datetime Collection creation timestamp.
updated_at datetime Collection update timestamp.

A visibility attribute can have one of the following values:

Visibility Value
Public 1
Logged In Users 2
Valid Envato Purchase Code 3
Valid Envato Support 4

# Paginate Collections

GET
/article-collections

# Request

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

# Example Response

{
    "data": [
      {
        "id": 1,
        "category_id": 12,
        "name": "My Collection",
        "order": 1,
        "visibility": 1,
        "created_at": "2019-09-30 12:09:10",
        "updated_at": "2019-09-30 12:09:10",
      },
      //...
    ],
    "links": {
        //...
    },
    "meta": {
        //...
    }
}

# Available includes

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

articles-count

A number of articles within the collection.

category

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

# Sortable Fields

order (default), created_at

# View a Collection

GET
/article-collections/{id}

# Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/article-collections/{id}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

# Example Response

{
    "data": {
      "id": 1,
      "category_id": 12,
      "name": "My Collection",
      "order": 1,
      "visibility": 1,
      "created_at": "2019-09-30 12:09:10",
      "updated_at": "2019-09-30 12:09:10"
    }
}

# Available includes

Same as for when paginating the collections.

# Create a Collection

POST
/article-collections

# Parameters

Parameter Type Required Validation
category_id number Yes An existing category id.
name string Yes Any string with length shorter or equal to 250 characters.
visibility number Yes Valid collection visibility.

# Request

curl --location --request POST 'https://yoursubdomain.support-hub.io/api/article-collections' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "Random Article Collection",
  "visibility": 1,
  "category_id": 37
}'

# Example Response

Status: 201 Created

{
    "data": {
      "id": 123,
      "category_id": 37,
      "name": "Random Article Collection",
      "order": 1,
      "visibility": 1,
      "created_at": "2019-09-30 12:09:10",
      "updated_at": "2019-09-30 12:09:10"
    }
}

# Update a Collection

POST
/article-collections/{id}

# Parameters

Parameter Type Required Validation
category_id number Yes An existing category id.
name string Yes Any string with length shorter or equal to 250 characters.
visibility number Yes Valid collection visibility.

# Request

curl --location --request POST 'https://yoursubdomain.support-hub.io/api/article-collections/123' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "Foo"
}'

# Example Response

Status: 200 OK

{
    "data": {
      "id": 123,
      "category_id": 37,
      "name": "Foo",
      "order": 1,
      "visibility": 1,
      "created_at": "2019-09-30 12:09:10",
      "updated_at": "2019-09-30 12:09:10"
    }
}

# Delete a Collection

DELETE
/article-collections/{id}

# Request

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

# Example Response

Status: 200 OK

{
    "success": true
}

# Update Order

Update order for the provided article collections.

POST
/article-collections/order
Parameter Type Required Validation Example
order array yes An associative array of order => article_collection_id elements. [0 => 1100, 1 => 1344, 2 => 3211]

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_collection_id within the received order array.

# Request

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

# Example Response

Status: 200 OK

{
    "success": true
}

# Update Visibility

Update the visibility for all provided article collections.

POST
/article-collections/visibility
Parameter Type Required Validation
collections array yes A valid array with article collection ids.
visibility integer yes Valid collection visibility enum.

# Request

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

# Example Response

Status: 200 OK

{
    "success": true
}

# Update Category

Update the category for all provided article collections.

POST
/article-collections/category
Parameter Type Required Validation
collections array yes A valid array with article collection ids.
category integer yes Valid category id.

# Request

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

# Example Response

Status: 200 OK

{
    "success": true
}