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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wpmobilepack.com/content-api/comments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
