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

Endpoint Description
exportcategories A list of all the categories with the latest posts for each of them
exportcategory A category’s details
exportarticles List of posts from a category
exportarticle A post’s details
exportpages A list of all the pages
exportpage A page’s details
exportcomments A list of comments for a post
save_comment Submit a comment for a post

Please note that 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 categories

Relative URL: /wp-content/plugins/wordpress-mobile-pack/export/content.php?content=exportcategories&callback=CallbackMethod

Sample code: on Gist

Parameters:

GET Params Type Required Description
content String Yes Equal to “exportcategories”.
callback String Yes The callback method.
limit Integer No The number of articles that are exported for each category. Default value is 7.
withArticles Integer No (Added from version 2.2.5) Pass a value different than 1 to export the categories without articles.
page Integer No (Added from version 2.2.5) Used for paginating categories. Default value is 1.
rows Integer No (Added from version 2.2.5) Used for paginating categories, indicates the number of categories per page. Default value is 5.
descriptionLength Integer No (Deprecated) The length (number of characters) of an article’s description. Default value is 200.

Response type: JSONP

Response format (for a category):

Field Type Required Description
id Alphanumeric string or integer Yes The id of the category. It is set to “0” (zero) for the “Latest” category which combines the newest articles from all categories. The “Latest” category is optional.
order Integer Yes The order in the categories menu.
name String Yes The category title
name_slug String Yes The category slug (used for url rewriting)
parent_id Alphanumeric string No (Added from version 2.2.5) The parent’s category ID. It is set to 0 (zero) for root categories.
link String, URL No The category’s original link (used for setting a rel=canonical tag and prevent SEO duplicate content issues). Default value is “” (empty string) that indicates not to use a rel=canonical tag.
image Object or empty string No The icon, displayed in the categories menu. Click here to see the specs for the image field. In case a category doesn’t have an icon, this field is set to “” (empty string).
articles List Yes A list with the articles from the category. Click here to see the specs for an article.

 

2) Exporting a category’s details

(Added from version 2.2.5) Relative URL: /wp-content/plugins/wordpress-mobile-pack/export/content.php?content=exportcategory&categoryId=0&callback=CallbackMethod

Parameters:

GET Params Type Required Description
content String Yes Equal to “exportcategory”.
callback String Yes The callback method.
categoryId Alphanumeric string or integer Yes The id of the category

Response type: JSONP

Response format:

Field Type Required Description
category Object Yes The category’s details. See below the category’s format.

Category format:

Field Type Required Description
id Alphanumeric string or integer Yes The id of the category. It is set to “0” (zero) for the “Latest” category.
name String Yes The category title
name_slug String Yes The category slug (used for url rewriting)
parent_id Alphanumeric string No The parent category’s id. It is set to 0 (zero) for root categories.
link String, URL No The category’s original link (used for setting a rel=canonical tag and prevent SEO duplicate content issues). Default value is “” (empty string) that indicates not to use a rel=canonical tag.
image Object or empty string No The icon, displayed in the categories menu. Click here to see the specs for the image field. In case a category doesn’t have an icon, this field is set to “” (empty string) or [] (empty array).

3) Exporting posts from a category

Relative URL: /wp-content/plugins/wordpress-mobile-pack/export/content.php?content=exportarticles&categoryId=0&callback=CallbackMethod

Sample code: on Gist

Parameters:

GET Params Type Required Description
content String Yes Equal to “exportarticles”.
callback String Yes The callback method.
categoryId Alphanumeric string or integer Yes The id of the category
lastTimestamp Integer No Used for implementing the “load more” functionality for a list of articles. If this parameter is passed, the endpoint will return articles that were published before this date. Usually, the timestamp of the last displayed article is used as a parameter for reading older articles.
limit Integer No The number of articles that are exported for the category. Default value is 7.
descriptionLength Integer No (Deprecated) The length (number of characters) of an article’s description. Default value is 200.

Response type: JSONP

Response format:

Field Type Required Description
articles List Yes A list with the articles from the category. Click here to see the specs for an article.

 

4) Exporting a post’s full content

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

Sample code: on Gist

Parameters:

GET Params Type Required Description
content String Yes Equal to “exportarticle”.
callback String Yes The callback method.
articleId Alphanumeric string or integer Yes The id of the article
descriptionLength Integer No (Deprecated) The length (number of characters) of the article’s description. Default value is 200.

Response type: JSONP

Response format:

Field Type Required Description
article Object Yes The article’s full details. Click here to see the specs for an article.

 

Post format

Sample code: on Gist

The exportcategories and exportarticles endpoints export a list of posts objects. In a similar way, the exportarticle endpoint exports the details for a post. Each post object contains the following fields:

Field Type Required Description
id Alphanumeric string or integer Yes The id of the post
title String Yes The title of the post
author String Yes The author’s name.
author_description String No (Added from version 2.2.5) The author’s description, it is exported only by the exportarticle endpoint.
author_avatar String No (Added from version 2.2.5) The author’s avatar, it is exported only by the exportarticle endpoint.
link String, URL Yes The article’s original link (from the desktop website). This field is also used to set the rel=”canonical” tag on the post’s details page.
image Object or empty string No The article’s featured image. Click here to see the specs for the image field. In case an article doesn’t have an image, this field is set to “” (empty string).
date String, datetime Yes The date the post was published, in the site’s timezone.
timestamp Integer Yes UNIX timestamp with the post’s published date; it is used to order the posts from newest to oldest.
description HTML / Text Yes The first part from the article, in HTML format.
content HTML / Text Yes The content for the post. It is set to an empty string for the exportcategories and exportarticles endpoints.
categories List Yes A list with all the post’s categories (a post can belong to multiple categories).
category_id Alphanumeric string or integer No (Deprecated) The current visible category id for the post. This property is deprecated and should not be used by new apps.
category_name String No (Deprecated) The current visible category name for the post. This property is deprecated and should not be used by new apps.
comment_status String No If comments are opened or closed for the post. Allowed values are ‘open’, ‘closed’ or ‘disabled’. New comments are allowed only for posts with comment_status = ‘open’. Default value is ‘disabled’.
no_comments Integer No The number of comments added for the post. Default value is “0” (zero).
show_avatars Integer No If the comments list should display users’ avatars. Can be set to “0” (zero) or “1”. Default value is “0” (zero).
require_name_email Integer No If name and email are required when submitting a new comment. Can be set to “0” (zero) or “1”. Default value is “0” (zero).

 

Image format

Sample code: on Gist

The “image” object for a category or article contains the following fields:

Field Type Required Description
src String, URL Yes The url of the image
width Numeric Yes Image width (in pixels)
height Numeric Yes Image height (in pixels)

 

5) Exporting pages

Relative URL: /wp-content/plugins/wordpress-mobile-pack/export/content.php?content=exportpages&callback=CallbackMethod

Sample code: on Gist

Parameters:

GET Params Type Required Description
content String Yes Equal to “exportpages”.
callback String Yes The callback method.

Response type: JSONP

Response format (for a page):

Field Type Required Description
id Alphanumeric string or integer Yes The id of the page
parent_id Alphanumeric string or integer Yes The parent page id. It is set to “0” (zero) for root pages.
order Integer Yes The order in the pages menu
title String Yes The page’s title
link String, URL No The page’s link (from the desktop website). This field is also used to set the rel=”canonical” tag on the object’s details page. Default value is “” (empty string) that indicates not to use a rel=canonical tag.
image Object or empty string No The page’s featured image. Click here to see the specs for the image field. In case a page doesn’t have an image, this field is set to “” (empty string).
has_content Integer Yes If the page has content (some pages are used just as parent pages to structure the menu). Can be set to “0” (zero) or “1”.
content String No Is equal to “” (empty string).

 

6) Exporting a page’s full content

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

Sample code: on Gist

Parameters:

GET Params Type Required Description
content String Yes Equal to “exportpage”.
callback String Yes The callback method.
pageId Alphanumeric string or integer Yes The id of the page

Response type: JSONP

Response format:

Field Type Required Description
id Alphanumeric string or integer Yes The id of the page
parent_id Alphanumeric string or integer Yes The parent page id. It is set to “0” (zero) for root pages.
title String Yes The page’s title
link String, URL No The page’s link (from the desktop website). This field is also used to set the rel=”canonical” tag on the object’s details page. Default value is “” (empty string) that indicates not to use a rel=canonical tag.
image Object or empty string No The page’s featured image. Click here to see the specs for the image field. In case a page doesn’t have an image, this field is set to “” (empty string).
has_content Integer Yes If the page has content (some pages are used just as parent pages to structure the menu). Can be set to “0” (zero) or “1”.
content HTML / Text Yes The page’s content in HTML format

 

7) Exporting comments

Relative URL: /wp-content/plugins/wordpress-mobile-pack/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.

 

8) Saving comments

Relative 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

Parameters:

GET Params Type Required Description
content String Yes Equal to “savecomment”.
callback String Yes The callback method.
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).