Tags

Tags allow for content to be grouped together. Tags are useful for grouping multiple articles, galleries and products into a single entity.

Traditionally tags are often a single word, or similar in to slugs in presentation. However, MotorPress provides a additional display "title" for tags. This can be handy for brands that want to use tags with very specific details. This means that tags with the same title can exist across different organisations, but will have different slugs.

Tags also don't have a unique UUID. Instead the unique slug is used as it's defining key.

The Tag Object

The tag object includes counts for the media that has been taged with this tag. Note that articles, galleries and products can be tagged. You can find a JSON schema for the tag object hereopen in new window.

{
    "title": "Tag Title",
    "slug": "tag-slug",
    "created_at": "2024-02-13T14:32:43+00:00",
    "articles_count": 5,
    "galleries_count": 1,
    "products_count": 0
},

Fetching Tags

OrganisationMedia

This endpoint is one of the few that does not return a paginated list. All tags are included in one go. Note that tags are organisation specific and only tags associated with the current organisation will be returned.

Endpoint

get
/tags
curl "https://api.motorpress.co.za/tags" \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer TEST_TOKEN'
<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.motorpress.co.za/tags');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'Accept: application/json',
  'Content-Type: application/json',
  'Authorization: Bearer TEST_TOKEN',
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response Body: ' . $response . PHP_EOL;

curl_close($ch);
{
  "data": [
    {
      "title": "Tag 1",
      "slug": "tag-1",
      "created_at": "2024-02-13T14:32:43+00:00",
      "articles_count": 5,
      "galleries_count": 1,
      "products_count": 0
    },
    {
      "title": "Tag 2",
      "slug": "tag-2",
      "created_at": "2024-02-13T14:32:43+00:00",
      "articles_count": 5,
      "galleries_count": 1,
      "products_count": 0
    },
    //...
  ]
}
Last Updated:
Contributors: Warrick Bayman, warrick