# Categories

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

| **Endpoint**     | **Description**                                                       |
| ---------------- | --------------------------------------------------------------------- |
| exportcategories | A list of all the categories with the latests posts for each of them. |
| exportcategory   | A category'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 categories**

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

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

Sample code: on [Gist](https://gist.github.com/appticles/d8c82615cc5d90af7f53#file-wpmp-content-api-exportcategories)

**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 7.                          |
| withArticles      | Integer  | No           | Pass a value different than 1 to export the categories  without articles.                                     |
| page              | Integer  | No           | Used for paginating             categories. Default value 1.                                                  |
| rows              | Integer  | No           | Used for paginating             categories, indicates the    number of categories per  page. Default value 5. |
| descriptionLength | Integer  | No           | (Deprecated) The length    (number of characters) of an article's description.      Default value 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           | 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](/content-api/posts.md) 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](/content-api/posts.md) to see the specs for an            article.                                                                                                             |

## **2) Exporting a category's details**

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

**Relative PRO URL:** /wp-content/plugins/wordpress-mobile-pack-pro/frontend/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=canconical tag.                                |
| image      | Object or empty string                 | No           | The icon, displayed in  the  categories menu. Click      [here](/content-api/posts.md) to see the specs for      the image field. In case a   category doesnt' have an      icon, this field is set to          " " (empty string) or               \[] (empty array). |


---

# 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/categories.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.
