API Documentation

Section

Resources for managing sections.

/{iid}/sections

GET

Retrieve a batched collection of sections/subsections.

Returns information about the instance's sections/subsections. {iid} is the Metro Publisher instance id. This resource accepts various parameters to limit/filter the information.

Sample Call

>>> GET("/123/sections?fields=title-parentid-url-urlname")
{'items': [['Sample Blog',
            None,
            'https://api.metropublisher.com/123/sections/c1c189f2-d24a-11e1-b431-001b63a90f63',
            'sample-blog'],
           ['Sample Section',
            None,
            'https://api.metropublisher.com/123/sections/c1c1b3dc-d24a-11e1-b1d7-001b63a90f63',
            'sample-section'],
           ['Sample Subsection',
            'c1c1b3dc-d24a-11e1-b1d7-001b63a90f63',
            'https://api.metropublisher.com/123/sections/c1c1a7f2-d24a-11e1-8bea-001b63a90f63',
            'sample-subsection']]}

Get all subsections of the section 'Sample Section' (UUID: 'c1c1b3dc-d24a-11e1-b1d7-001b63a90f63'):

>>> GET("/123/sections?fields=title-parentid&parent=c1c1b3dc-d24a-11e1-b1d7-001b63a90f63")
{'items': [['Sample Subsection', 'c1c1b3dc-d24a-11e1-b1d7-001b63a90f63']]}

Get all top-level sections:

>>> GET("/123/sections?fields=title-parentid&parent=root")
{'items': [['Sample Blog', None], ['Sample Section', None]]}

Get all top-level sections plus subsections of section 'Sample Section' (UUID: 'c1c1b3dc-d24a-11e1-b1d7-001b63a90f63'):

>>> GET("/123/sections?fields=title-parentid&parent=c1c1b3dc-d24a-11e1-b1d7-001b63a90f63_root")
{'items': [['Sample Blog', None],
           ['Sample Section', None],
           ['Sample Subsection', 'c1c1b3dc-d24a-11e1-b1d7-001b63a90f63']]}

Parameters

page:

The page number to retrieve.

optional

Default: 1

Values must not be lower than 1

rpp:

The number of results per page.

optional

Default: 20

Values must not be lower than 1 or higher than 100

fields:

A dash-separated list of fields to return.

optional

Default: ['url']

Example value: 'hide_in_nav-uuid'

Every element of the list must be any of the following

hide_in_nav:The flag whether the section is supposed to be hidden from the navigation or not.
ord:The order number of the section.
parentid:The UUID of the section parent (None if the section is a top-level section)
title:The title
url:URL to the section
urlname:The urlname
uuid:The UUID of the section
order:

A dash-separated list of orderings to apply

optional

Default: ['title']

Example value: 'title-urlname.desc'

Every element of the list must be any of the following

title:Sort by title ascending
title.asc:Sort by title ascending
title.desc:Sort by title descending
urlname:Sort by urlname ascending
urlname.asc:Sort by urlname ascending
urlname.desc:Sort by urlname descending
uuid:Sort by UUID ascending
uuid.asc:Sort by UUID ascending
uuid.desc:Sort by UUID descending
parents:
An underbar-separated list of section UUIDs. Only return subsections of these sections. The optional

value 'root' is allowed.

  • If the list contains only the word 'root', all top-level sections are returned, i.e. all sections that do not have a parent section.
  • If the list contains UUIDs and the word 'root', all top-level sections plus the subsections of the given section UUIDs are returned.

optional

Default: None

parent:
An underbar-separated list of section UUIDs. Only return subsections of these sections. The optional

value 'root' is allowed.

  • If the list contains only the word 'root', all top-level sections are returned, i.e. all sections that do not have a parent section.
  • If the list contains UUIDs and the word 'root', all top-level sections plus the subsections of the given section UUIDs are returned.

optional

Default: None

POST

Deprecated method to create a section.

Note

DEPRECATED

Please use PUT /{iid}/sections/{uuid}.

/{iid}/sections/{uuid}

GET

Retrieve one section/subsection.

Sample Call

>>> GET("/123/sections/c1c1b3dc-d24a-11e1-b1d7-001b63a90f63")
{'auto_featured_stories': True,
 'auto_featured_stories_num': 5,
 'externalurl': None,
 'feature_image_url': None,
 'hide_in_nav': False,
 'lead_story_url': None,
 'meta_description': None,
 'meta_keywords': None,
 'meta_title': None,
 'ord': 1,
 'parent_uuid': None,
 'show_prev_next': False,
 'title': 'Sample Section',
 'urlname': 'sample-section',
 'uuid': 'c1c1b3dc-d24a-11e1-b1d7-001b63a90f63'}

Return Value

auto_featured_stories:

Automatically generate featured stories (and ignore manually set ones)

Access is restricted to users with these roles:

auto_featured_stories_num:

The maximum number of automatically generated featured stories to generate

Access is restricted to users with these roles:

externalurl:

If not None the section links to the specified URL

feature_image_url:

URL for the section's feature image.

hide_in_nav:

Hide the section in the navigation

lead_story_url:

URL for the section's lead story.

meta_description:

The text for the HTML meta description tag on the section page.

meta_keywords:

The text for the HTML meta keywords tag on the section page.

meta_title:

The text for the HTML meta title tag on the section page.

ord:

The order of the section compared to other sections of the same level.

parent_uuid:

The UUID of the section above this one. If None, this section is a top level section

show_prev_next:

New in MP 2.10:

With MP 2.10, sections are enhanced to work like blogs.

(also see ChangeLog)

title:

The section title

urlname:

see urlname

uuid:

The section UUID.

PUT

Create a new section/subsection.

Posting to this resource creates a new section/subsection.

Sample Call

>>> PUT("/123/sections/12345678-1234-1234-1234-123456789abc",
...                       {"urlname": "sports",
...                        "title": "Sports",
...                        "feature_image_uuid": u"2b980c21-97a6-3f19-b26e-2606382cf0c9"})
{'url': 'https://api.metropublisher.com/123/sections/12345678-1234-1234-1234-123456789abc',
 'uuid': '12345678-1234-1234-1234-123456789abc'}

Parameters

urlname:

see urlname

required

Example value: "sports"

Values must obey all the conditions

  • match the following regular expression:

    ^[^/@+][^/]*$

    Info: may not start with either @ or + and may not contain /.

  • be unique

title:

The title of the section.

required

Example value: "Sports"

meta_title:

The text for the HTML meta title tag.

optional

Default: None

Example value: "Sports - Basketball, Football, and more"

meta_description:

The text for the HTML meta description tag.

optional

Default: None

Example value: "Sports - Basketball, Football, and more"

meta_keywords:

The text for the HTML meta keywords tag.

optional

Default: None

Example value: "sports, basketball, football, icehockey, tennis"

feature_image_uuid:

UUID of a linked image

optional

Default: None

Example value: '123456578-1234-1234-1234-123456789abc'

Values must obey all the conditions

  • be existing image UUID

  • be UUID or None

feature_image_caption:

optional

Default: None

feature_image_alttext:

optional

Default: None

parent_uuid:

The UUID of the parent section.

optional

Default: None

Example value: '123456578-1234-1234-1234-123456789abc'

Section with the given UUID must exist in the Metro Publisher instance.

externalurl:

The 'external' url for this section.

optional

Default: None

Example value: "http://www.external.com or '/blogs/my-blog/'"

Values must obey all the conditions

  • match the following regular expression:

    ^[A-Za-z][-A-Za-z0-9+\.]*:

    Info: The value should be a URL with a scheme. The regular expression does a simple check to make sure the value starts with a letter, is followed by zero or more letters, numbers, or the plus-sign (+), minus-sign (-) or dot (.), and then a colon (:).

  • Value must be more than just the URL scheme (i.e. more than just 'http://').

hide_in_nav:

Defines whether the section will appear in the public navigation or not.

optional

Default: False

Values must be any of the following

False:

The section will appear in the public navigation.

True:

The section will be not appear in the public navigation.

content_uuid:

The UUID of the featured content (such as an article).

optional

Default: None

Example value: '123456578-1234-1234-1234-123456789abc'

Content object with the given UUID must exist in the Metro Publisher instance.

auto_featured_stories:

Defines whether the section landing page shows automatic featured stories or manually selected ones.

optional

Default: True

Values must be any of the following

False:

The section landing page shows manually selected featured stories.

True:

The section landing page shows automatic featured stories (last issued content from within the section).

number_stories:

If 'auto_featured_stories' is True, this value defines how many stories are to appear on the section landing page.

optional

Default: 5

Values must not be lower than 1 or higher than 20

show_prev_next:

Defines whether prev/next links appear on content pages within this section.

New in MP 2.10:

With MP 2.10, sections are enhanced to work like blogs.

(also see ChangeLog)

optional

Default: False

Values must be any of the following

False:

Content within this section does NOT have links to the next/previous content.

True:

Content within this section has links to the next/previous content.

ord:

The place number at which the section appears in the navigation.

optional

Default: 1

/{iid}/sections/{uuid}/path_history

GET

Get the path history of a section.

Sample Call

>>> GET("/123/sections/799d6c73-fe75-11df-837b-001ec21bff9e/path_history")
{'items': [{'path': '/old-section/'},
           {'path': '/index.php?s_id=123'},
           {'path': '/old-section/index.php'}]}

/{iid}/sections/{uuid}/path_history

POST

Create new path history entry for the section.

This resource creates a new path history entry and adds it to the existing list of path history entries for the section.

Sample Call

Add a new path history entry:

>>> POST("/123/sections/799d6c73-fe75-11df-837b-001ec21bff9e/path_history",
...                      {"path": "/old-section/index.html"})
{'msg': 'path added'}

Parameters

path:

The unquoted, utf-8-decoded old path to the section.

required

Example value: "/old-section/index.html"

must be an absolute path

/{iid}/sections/{uuid}/path_history

PUT

Create/update the path_history of the section.

This resource creates/replaces the path_history of the section.

Sample Call

Set the path history of a section:

>>> PUT("/123/sections/799d6c73-fe75-11df-837b-001ec21bff9e/path_history",
...            {'items': [{"path": "/section-123"},
...                       {"path": "/old-section/index.html"}]})
{'msg': 'path history updated'}

Remove a section's path history:

>>> PUT("/123/sections/799d6c73-fe75-11df-837b-001ec21bff9e/path_history",
...            {'items': []})
{'msg': 'path history updated'}

Parameters

items:

required

Every element of the list is a dictionary, each consisting of the following fields:

path:

The unquoted, utf-8-decoded old path to the section.

required

Example value: "/old-section/index.html"

must be an absolute path