The Fifth World

Get templates

Many pages on the Fifth World website use templates. We define a few special templates in our system, like Children or Gallery, but members can create their own templates just by creating a new page. A page with the type Template can use variables. Then, when another page uses that template, it can define those variables, and when we render the page, we replace the template invocation with the template, rendered with the variables provided.

But some pages also use this format even without a defined template used for rendering, as a means of applying structured data to a page.

This endpoint allows you to query the database for pages that use a given template, as well as the parameters supplied for each instance.

Request

HTTP Headers
HTTP Header Value
Authorization A valid JSON Web Token, of the form Bearer ENCODEDHEADER.ENCODEDPAYLOAD.ENCODEDSIGNATURE. If not supplied, your response will only include publicly-readable items. If supplied, your response can include other items that you have permission to view.
Query Parameters
Query Parameter Value
name Required. The name of the template you want to find.
parameter Optional. The name of a parameter used by the template. If provided, the endpoint will only return those pages that use the template and provide this parameter.
value Optional. The value of a parameter used by the template. If you provide both this and parameter, the endpoint will only return those pages that use the template, provide the given parameter, and set it to this value.

Examples

Example Request
GET /v1/templates?name=Artists HTTP/1.1 Host: api.thefifthworld.com

Response

The endpoint responds with a 200 HTTP code and a JSON string with an array of objects. Each object in this array represents a page that uses the template you queried, with path and title properties, along with a templates property, which provides an array of template instances on the page matching your query. The name of the template is also a property in these objects, called template.

Response JSON
Property Value Type Value
path string The unique path of the page.
title string The page’s title.
templates array An array of instance objects.
Instance Object
Property Value Type Value
template string The name of the template.
Varies string The parameters used by this instance of the template each become a property in the returned instance object, set to the values provided for them. For example, the string {{Example param="val"}} comes back as { template: 'Example', param: 'val' }

Example

Example Response
[ { path: '/art', title: 'Art', templates: [ { template: 'Artists' } ] } ]