Articlegroup

An object representing an article group.

Properties

Property Description
baseName The base name that is used when generating a URL for the article group, by language. Unless otherwise specified then baseName is generated from name.
children A list of unique identifiers for all the article groups immediately below the article group, if any. For administrators only.
description Article-group description by language, e.g. {"en": "Organic shampoo for dry hair", "sv": "Ekologiskt schampo för torrt hår"}.
hidden Whether the article group and its contents are hidden.
image URL to an article-group image.
metaDescription Text to be used for the HTML meta element named "description", by language.
metaKeywords Text to be used for the HTML meta element named "keywords", by language.
name Name of the article group, by language.
pageItems A list of custom page items that's connected to this articlegroup.
pageTitle The page title, by language.
parent The unique identifier of the parent article group, if any.
uid The unique identifier of the article group.
url URL of the article-group page, by language.

Methods

count

Takes a filter object and returns the number of article groups found, as an integer.

Parameters

A filter object specifying which article groups to count. See Filter objects on the page List selection.

Example

The request below returns the number of article groups where the name in English starts with "Organic".

API Console
Articlegroup.count(
  {
    "/name/en": {
      "startsWith": "Organic"
    }
  }
)
Response
15

create

Creates a new article group. This is a shorthand for set with the unique identifier as null.

Parameters

Parameter Description
patch An object containing the properties and values to set for the new article group.
query A query specifying what to return after article-group creation has been successful (optional). See Query language.

get

Fetches information about an article group.

Parameters

Parameter Description
uid The unique identifier of an article group.
query Which info to return. See Query language.

Example

API Console
Articlegroup.get(12345, {"uid": true, "name": ["en", "sv"], "children": true})
Response
{
  "name": {
    "en": "Organic shampoo",
    "sv": "Ekologiskt schampo"
  },
  "children": [
    12346,
    12347
  ],
  "uid": 12345
}

getSchema

Fetches the JSON Schema which can be used for client-side validation.

Parameters

The unique identifier of an article group or null for a new article group.

list

Fetches multiple article groups as an array of article-group objects.

Parameters

Parameter Description
query Which info to return. See Query language.
selection Which article groups to list. See List selection.

Filters

Apart from filtering on the properties using their JSON pointers, the following filters exist:

Filter Description
empty Article groups without articles, including in any subgroups (children).

The following orderings are available:

  • uid
  • name
  • position

Example

The following request returns an array of all the article groups at the root level, i.e. all of those without a parent, where the name in English starts with "Organic":

API Console
Articlegroup.list(["uid", "name"], {"filters": {"/parent": null, "/name/en": {"startsWith":"Organic"}}})
Response
[
  {
    "name": {
      "en": "Organic shampoo",
      "sv": "Ekologiskt schampo"
    },
    "uid": 12345
  }
  {
    "name": {
      "en": "Organic toothpaste",
      "sv": "Ekologisk tandkräm"
    },
    "uid": 12346
  }
]

set

Creates or updates an article group.

Parameters

Parameter Description
uid The unique identifier of an article group to update or null to create a new one.
patch An object containing the properties and values to set for the article group.
query A query specifying what to return after a successful set (optional).

Example

API Console
Articlegroup.set(12345, {"name": {"en": "Organic shampoo", "sv": "Ekologiskt schampo"}}, ["uid", "name"])
Response
{
  "uid": 12345,
  "name": {
    "en": "Organic shampoo",
    "sv": "Ekologiskt schampo"
  }
}

normalize

Fetches a normalized version of the patch. Uses the same parameters as set and validate. While set also normalizes the patch, before writing to the file, normalize only returns the normalized patch. For all the properties with number types, integers or floating-point values in strings are converted to number literals. A normalization error is thrown when we are unable to convert a string to a number literal.

Parameters

Parameter Description
uid The unique identifier of an article or null to create a new article group.
patch An object containing the properties and values to normalize.

Example

API Console
Articlegroup.normalize(123456, {"parent": "1"})
Response
{
  "uid": 123456,
  "parent" : 1
}

validate

Validates the data to be set. The performed validation is the same as in set; it validates the resulting object and includes all the required properties. However, nothing is saved.

Parameters

Parameter Description
uid The unique identifier of an existing article group or null.
patch An object containing the properties and values to set before validating.

Returns

An array of validation-error objects, each containing the keys pointer (a property referenced using a JSON Pointer) and message (a readable text in the language of the context). If there are no validation errors, then an empty array is returned.

tree

Fetches multiple article groups as a tree.

Parameters

Parameter Description
root The unique identifier of the Articlegroup as the starting point for the tree. Use null for the root level.
query Which info to return. See Query language.
selection Which article groups to list. See List selection.
depth The number of levels in the article-group hierarchy (optional).

Example

API Console
Articlegroup.tree(null, ["uid", "name", "url", "children"], true)
Response
[
  {
    "uid": 12345,
    "name": {"en": "Organic shampoo"},
    "url": {"en": "http://shop.example.com/en/organic-shampoo.php"}
    "children": [
       {
          "uid": 11111,
          "name": {"en": "Dry hair"},
          "url": {"en": "http://shop.example.com/en/organic-shampoo/dry-hair.php"}
          "children": [
            {
              "uid": 22222,
              "name": {"en": "Coloured hair"},
              "url": {"en": "http://shop.example.com/en/organic-shampoo/dry-hair/coloured-hair.php"}
              "children": []
            },
          ]
       },
       {
          "uid": 11112,
          "name": {"en": "Greasy hair"},
          "url": {"en": "http://shop.example.com/en/organic-shampoo/greasy-hair.php"}
          "children": []
       }
     ]
  }
]