Posts

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

Endpoint

Description

exportarticles

List of posts from a category.

exportarticle

A post's details.

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 posts from a category

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

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

descriptionLength

Integer

No

(Deprecated) The length (number of characters) of an article's description. Default value 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.

2) Exporting a post’s full content

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

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

Sample code: onGist

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 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

The author's description, it is exported only by the exportarticle endpoint.

author_avatar

String

No

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 artucle's featured image. 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 time zone.

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

Last updated