Topics

High-level topic-based hierarchical taxonomy used to categorize articles and galleries.

Get a collection

Endpoint
GET /topics HTTP/1.1

Query string parameters

All query string parameters are optional.

callback string

Wraps the response in a callback function of the given name. Use this parameter to facilitate JSONP requests.

excluded_ids comma-separated list of IDs

Returns topics, except those with the given IDs.

ids comma-separated list of IDs

Return topics with the given IDs.

order_by comma-separated list

Sort topics by one or more ORDER_BY and ORDER parameter pairs. Options:

  • ORDER:
    • asc: order from lowest to highest values
    • desc: order from highest to lowest values
  • ORDER_BY:
    • id: order by topic ID
    • list: order by the order of IDs given in the ids parameter
    • name: order by term name
    • weight: order by term weight

Format: ORDER_BY|ORDER[,ORDER_BY|ORDER,...]

Default value: name|asc

page integer

Return topics from a specific page of a collection.

Default value: 1

per_page integer

Number of topics to return per page of a collection. Maximum: 100

Default value: 5

slug comma-separated list

Return topics matching the given slug(s).

Response

In the example response, embedded topics are truncated for illustrative purposes. In the real-world version of the response, "...topic object..." is an entire topic resource.

The topic collection
{
   "_embedded": {
      "topics": [
         "...topic object...",
         "...topic object...",
         "...topic object...",
         "...topic object...",
         "...topic object..."
      ]
   },
   "_links": {
      "find": {
         "href": "/topics/{?id}",
         "templated": true
      },
      "next": {
         "href": "/topics?page=3"
      },
      "prev": {
         "href": "/topics?page=1"
      },
      "self": {
         "href": "/topics?page=2"
      }
   },
   "page": 1,
   "per_page": 5,
   "return_count": 5,
   "total_available": 100
}

Attributes

_embedded hash

Embedded resources.

_embedded.topics[] array

An array of topic objects.

page integer

The page number of the returned collection.

per_page integer

The number of topics requested per page.

return_count integer

Number of topics returned.

total_available integer

Total number of topics available in the collection.

Get one

Endpoint
GET /topics/:id HTTP/1.1

Endpoint parameters

id integer required

The unique identifier of the topic.

Response

GET /topics/3162
{
   "_embedded": {},
   "_links": {
      "self": {
         "href": "/topics/3162"
      }
   },
   "id": 3162,
   "name": "Tools+Tech",
   "parent": {
      "id": 3158,
      "name": "At Work",
      "slug": "at-work"
   },
   "slug": "tools-tech",
   "type": "topic",
   "url": {
      "articles": "https://hub.jhu.edu/at-work/tools-tech/"
   }
}

Attributes

_embedded hash

Embedded resources.

id integer

Unique identifier of the topic.

name string

The nice name of the topic.

parent hash|null

The parent topic, if there is one.

parent.id integer

Unique identifier of the parent topic.

parent.name string

The nice name of the parent topic.

parent.slug string

The name of the parent topic used in URLs.

slug string

The name of the topic used in URLs.

type string

Type of resource.

url hash

URLs that point to collections of content in this topic on the Hub website.

url.articles string

Points to the collection of articles in this topic on the Hub.

Get a subcollection

A subcollection is a collection of objects contained within a topic.

Endpoint
GET /topics/:id/:subcollection HTTP/1.1

Endpoint parameters

id integer
The unique identifier of the topic.
subcollection string

The name of the subcollection to retrieve. Options: articles

Query string parameters

To filter the subcollection, see the list of available parameters associated with the chosen subcollection:

Response

See the response associated with the chosen subcollection: