Resources for managing sections.
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.
>>> 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']]}
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
|
||||||||||||||||||
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
|
||||||||||||||||||
parents: |
optional Default: None |
||||||||||||||||||
parent: |
optional Default: None |
Retrieve one section/subsection.
>>> 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'}
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: | |
title: | The section title |
urlname: | see urlname |
uuid: | The section UUID. |
Create a new section/subsection.
Posting to this resource creates a new section/subsection.
>>> 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'}
urlname: | see urlname required Example value: "sports" Values must obey all the conditions
|
||||
---|---|---|---|---|---|
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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. optional Default: False Values must be any of the following
|
||||
ord: | The place number at which the section appears in the navigation. optional Default: 1 |
Get the featured stories of a section.
This resource returns information depending on how the section is configured, i.e. whether it is configured for automatic or for manually selected featured stories.
Section with automatic featured stories:
>>> GET("/123/sections/c1c1b3dc-d24a-11e1-b1d7-001b63a90f63/featured_stories")
{'items': [{'description': 'This is descriptive text for a review...',
'issued': '2010-12-05T15:51:00',
'thumb_url': 'https://api.metropublisher.com/123/files/5a778106-5e32-3af2-9bb6-97aeacf01c8e/download/1291558800',
'title': 'Review 01',
'type': 'content',
'url': 'https://api.metropublisher.com/123/content/133b5997-00ca-11e0-b096-001ec21bff9e',
'uuid': '133b5997-00ca-11e0-b096-001ec21bff9e'},
{'description': 'This is descriptive text for a video...',
'issued': '2010-12-05T08:40:00',
'thumb_url': 'https://api.metropublisher.com/123/files/988bf2d3-5a84-374e-a51b-1f080b8d16fc/download/1291535462',
'title': 'Video 01',
'type': 'content',
'url': 'https://api.metropublisher.com/123/content/2e06fa2e-008e-11e0-9a76-001ec21bff9e',
'uuid': '2e06fa2e-008e-11e0-9a76-001ec21bff9e'},
{'description': 'This is descriptive text for an article...',
'issued': '2010-12-02T16:37:00',
'thumb_url': 'https://api.metropublisher.com/123/files/f6294df8-9023-3687-865b-af22de234abf/download/1291309162',
'title': 'Article 01',
'type': 'content',
'url': 'https://api.metropublisher.com/123/content/799d6c73-fe75-11df-837b-001ec21bff9e',
'uuid': '799d6c73-fe75-11df-837b-001ec21bff9e'}]}
Section with manually selected featured stories:
>>> GET("/123/sections/c1c1a7f2-d24a-11e1-8bea-001b63a90f63/featured_stories")
{'items': [{'description': 'This is descriptive text for a blog entry...',
'issued': '2010-12-05T08:23:00',
'thumb_url': 'https://api.metropublisher.com/123/files/8c6d9a53-bc57-3584-bfab-056ebb6dd6cc/download/1291309190',
'title': 'Blog Entry 02',
'type': 'content',
'url': 'https://api.metropublisher.com/123/content/124d384f-008b-11e0-9c6f-001ec21bff9e',
'uuid': '124d384f-008b-11e0-9c6f-001ec21bff9e'},
{'description': 'This is descriptive text for a video...',
'issued': '2010-12-05T08:40:00',
'thumb_url': 'https://api.metropublisher.com/123/files/988bf2d3-5a84-374e-a51b-1f080b8d16fc/download/1291535462',
'title': 'Video 01',
'type': 'content',
'url': 'https://api.metropublisher.com/123/content/2e06fa2e-008e-11e0-9a76-001ec21bff9e',
'uuid': '2e06fa2e-008e-11e0-9a76-001ec21bff9e'},
{'description': 'This is descriptive text for an event...',
'issued': '2010-12-05T14:46:00',
'thumb_url': 'https://api.metropublisher.com/123/files/eb288cd7-5425-388a-8a97-b9f6b0c9b9ef/download/1291556764',
'title': 'Event 01',
'type': 'content',
'url': 'https://api.metropublisher.com/123/content/7c3fb9f0-00c1-11e0-914c-001ec21bff9e',
'uuid': '7c3fb9f0-00c1-11e0-914c-001ec21bff9e'}]}
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.
Add a new path history entry:
>>> POST("/123/sections/799d6c73-fe75-11df-837b-001ec21bff9e/path_history",
... {"path": "/old-section/index.html"})
{'msg': 'path added'}
path: | The unquoted, utf-8-decoded old path to the section. required Example value: "/old-section/index.html" must be an absolute path |
---|
Create/update the path_history of the section.
This resource creates/replaces the path_history of the section.
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'}
items: | required Every element of the list is a dictionary, each consisting of the following fields:
|
---|