API Documentation

Comments

/{iid}/comments

GET

Retrieve a batched collection of comments.

This resource returns a batched list of comments. The comment information returned depends on the fields parameter.

Sample Call

>>> GET("/123/comments?fields=uuid-title-state-parent_url-parent_type")
{'items': [['12345678-1234-1234-1234-123456789abc',
            'I think...',
            'published',
            'https://api.metropublisher.com/123/content/799d6c73-fe75-11df-837b-001ec21bff9e',
            'content']]}

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

state:

optional

Default: 'published' if the user is a public user else None.

Values must be any of the following

published:

Only published

draft:

Only draft

Access is restricted to users with these roles:

fields:

A dash-separated list of fields to return.

optional

Default: ['url']

Example value: 'created-uuid'

Every element of the list must be any of the following

created:The creation date/time.
parent_type:The type of the comment's parent, e.g. 'content' or 'comment'.
parent_url:URL to the comment's parent. This could, for example, be another comment or a content object (see 'parent_type').
parent_uuid:The UUID of the comment's parent.
state:The comment state, i.e. 'draft' or 'published'.
title:The comment title
url:URL to the comment
uuid:The UUID of the comment
order:

A dash-separated list of orderings to apply

optional

Default: None

Every element of the list must obey all the conditions

  • be any of the following

    created:Sort by created ascending
    created.asc:Sort by created ascending
    created.desc:Sort by created descending
    title:Sort by title ascending
    title.asc:Sort by title ascending
    title.desc:Sort by title descending
    tree:Sort by created ascending, within tree structure
    uuid:Sort by uuid ascending
    uuid.asc:Sort by uuid ascending
    uuid.desc:Sort by uuid descending
  • The order choice tree cannot be used together with another order choice.

parents:

An underscore-seperated list of comment parent UUIDs.

optional

Default: None

/{iid}/comments/{uuid}

GET

Retrieve one comment.

This resource returns information about one specific comment.

Sample Call

>>> GET("/123/comments/12345678-1234-1234-1234-123456789abc")
{'comment': '... this article rocks!',
 'created': '2000-01-01T10:00:00',
 'creator': 'Hans Meier',
 'edited_comment': None,
 'edited_title': None,
 'email': 'hans.meier@domain.com',
 'fb_uid': '12345678910',
 'parent_type': 'content',
 'parent_url': 'https://api.metropublisher.com/123/content/799d6c73-fe75-11df-837b-001ec21bff9e',
 'state': 'published',
 'title': 'I think...',
 'uuid': '12345678-1234-1234-1234-123456789abc'}

Return Value

comment:The original comment text.
created:The creation date/time in ISO 8601 format. See Dates and Times.
creator:The name of the commentor.
edited_comment:The edited version of the original comment text. The comment may have been edited by, for example, a moderator due to typos or to update the original comment.
edited_title:The edited version of the original comment title. The title may have been edited by, for example, a moderator due to a typo or to update the original title.
email:The email address of the commentor.
fb_uid:The Facebook User-ID of the commentor.
parent_type:The type of the comment's parent object, i.e. whether the parent is a comment itself or a content object.
parent_url:URL of the comment's parent object, e.g. the comment for which this comment is a reply or a content object like an article.
state:The comment state, i.e. 'draft' or 'published'
title:The original comment title
uuid:The UUID of the comment.

PUT

Create/update a comment.

Sending data to this resource does one of two things:

  • creates a new comment if no comment with the given UUID was found, or
  • updates the comment with the given UUID.

Sample Call

>>> PUT("/123/comments/12345678-1234-1234-1234-123456789abc",
...                           {"title": "I think...",
...                            "comment": "... this article rocks!",
...                            "created": "2000-01-01T10:00:00",
...                            "creator": "Hans Meier",
...                            "email": "hans.meier@domain.com",
...                            "fb_uid": "12345678910",
...                            "state": "published",
...                            "parent_type": "content",
...                            "parent_uuid": "799d6c73-fe75-11df-837b-001ec21bff9e",
...                            })
{'url': 'https://api.metropublisher.com/123/comments/12345678-1234-1234-1234-123456789abc',
 'uuid': '12345678-1234-1234-1234-123456789abc'}

Parameters

parent_type:

This is the type of the comment's parent, e.g. 'content' or 'comment'.

required

Example value: "content"

Values must be any of the following

comment:

The comment's parent is a comment, i.e. this comment is a reply to another comment.

content:

The comment's parent is a content object.

parent_uuid:

The UUID of the comment to which this comment is a reply.

required

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

title:

The original comment title

required

Example value: "My 2 cents"

edited_title:
The edited version of the original comment title. The title may have been edited

by, for example, a moderator due to a typo or to update the original title.

optional

Default: None

Example value: "My 2¢"

comment:

The original comment text.

required

Example value: "I think this article rocks!"

edited_comment:
The edited version of the original comment text. The comment may have been edited

by, for example, a moderator due to typos or to update the original comment.

optional

Default: None

Example value: "I think this article is very well written!"

created:

The creation date/time in ISO 8601 format. See Dates and Times.

optional

Default: <current timestamp>

Example value: '2012-01-01T11:30:45'

creator:

The name of the commentor.

optional

Note

required

if 'fb_uid' is empty

state:

The comment state.

optional

Default: 'draft'

Values must be any of the following

draft:

This object is a draft and is not visible on the public website.

published:

This object is published and is visible on the public website.

fb_uid:

A Facebook User-ID.

optional

Note

required

if 'creator' is empty

Values must match the following regular expression:

^[0-9]*$

Info: The value must consist only of numbers.

email:

The email address of the commenting user.

optional

Default: None

Values must match the following regular expression:

^[A-Za-z0-9!#$%&'*+/=?^_`{|}~.-]+@[A-Za-z0-9.-]+\.[A-Za-z]*$

Info: The regular expression tries to verify the following pattern:

<string of characters>@<string of characters>.<string of characters>

The first string may contain a number of different special characters besides letters and numbers, such as an underscore (_) or asterisk (*), while the second string must contain only letters, numbers, dashes (-) and dots (.).

Table Of Contents

Previous topic

Index Resources

Next topic

Content