> For the complete documentation index, see [llms.txt](https://docs.wpmobilepack.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wpmobilepack.com/content-api/comments.md).

# 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](https://gist.github.com/appticles/d8c82615cc5d90af7f53#file-wpmp-content-api-exportcomments)

**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:**&#x4A;SONP

**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). |
