Comments

The WP Mobile Pack content API implements a series of endpoints that are responsible for exporting comments. These are as follows:

Endpoint

Description

exportcomments

A list of comments for a post.

save_comment

Submit a comment for a post.

Please note all endpoints support JSONP.

All URL’s are relative to the WP Mobile Pack installation folder, typically located at /wp-content/plugins/wordpress-mobile-pack.

1) Exporting comments

Relative FREE URL:/wp-content/plugins/wordpress-mobile-pack/export/content.php?content=exportcomments&articleId=1&callback=CallbackMethod

Relative PRO URL:/wp-content/plugins/wordpress-mobile-pack-pro/frontend/export/content.php?content=exportcomments&articleId=1&callback=CallbackMethod

Sample code: on Gist

Parameters:

GET Params

Type

Required

Description

content

String

Yes

Equal to "exportcomments".

callback

String

Yes

The callback method.

articleId

Alphanumeric string or integer

Yes

The post's ID.

Response type:JSONP

Response format (for a comment):

Field

Type

Required

Description

id

Alphanumeric string or integer

Yes

The ID of the comment.

author

String

Yes

The author's name.

author_url

String, URL

Yes

The comment author's URL (usually their web site), not linked.

avatar

String, URL

Yes

Avatar URLs for the author.

date

String, datetime

Yes

The comment's date.

content

HTML/Text

Yes

The comment's content.

article_id

Alphanumeric string or integer

Yes

The post's id.

2) Saving comments

Relative FREE URL:/wp-content/plugins/wordpress-mobile-pack/export/content.php?content=savecomment&articleId=1&author=Author&email=user@dummyemailaddress.com& comment=comment%text&code=accessToken&callback=CallbackMethod

Relative PRO URL:/wp-content/plugins/wordpress-mobile-pack-pro/frontend/export/content.php?content=savecomment&articleId=1&author=Author&email=user@dummyemailaddress.com& comment=comment%text&code=accessToken&callback=CallbackMethod

Parameters:

GET Params

Type

Required

Description

content

String

Yes

Equal to "savecomment".

callback

String

Yes

The callback.

articleId

Alphanumeric string or integer

Yes

The post's id.

author

String

Yes/No

The comment author's name. Is required if require_name_email from the post is set to 1.

email

String

Yes/No

The comment author's e-mail address. Is required if require_name_email from the post is set to 1.

comment

String

Yes

The comment's text.

code

String

Yes

Access token.

Response type: JSONP

Response format:

Field

Type

Required

Description

status

Integer

Yes

The status of the comment. Possible values are: - 0 -- error, comment was not added. - 1 -- comment was successfully added and approved. - 2 -- comment was successfully added and is awaiting moderation.

message

String

Yes

Success / error message. Possible values are: - "Invalid post id" (status = 0). - "Comments are closed" (status = 0). - "Missing name or email" (status = 0). - "Invalid email address" (status = 0). - "Missing comment" (status = 0). - "Duplicate comment" (status = 0). - "Your comment was successfully added" (status = 1). - "Your comment is awaiting moderation" (status = 2).

Last updated