ClassicPress Directory API

The ClassicPress DirectoryAPI is an Application Programming Interface (API) that lets you pull different details about plugins (and in the future themes) listed on the ClassicPress Directory, such as Plugin requirements, a List of Developers, or Plugins developed by a specific Developer.

Developers API EndpointLink to this section

URL: https://directory.classicpress.net/api/developers/

You can retrieve a paginated list of all published developers. The response will hold a JSON Object holding the Developer Information without the plugins array as seen in the below.

URL: https://directory.classicpress.net/api/developers/{slug}

The {Slug} represents the Developer’s slug.

You can retrieve informations about each published ClassicPress Developer. The response will hold a JSON Object holding the Developer Information as seen in the below example using the ClassicPress Developer Profile:

{
  "data": {
    "name": "ClassicPress",
    "slug": "classicpress",
    "web_url": "https://directory.classicpress.net/developers/classicpress",
    "username": null,
    "website": "https://classicpress.net",
    "plugins": [
      {
        "name": "Classic Commerce",
        "description": "A simple but powerful e-commerce platform, forked from WooCommerce, built for ClassicPress.",
        "developer": {
          "name": "ClassicPress",
          "slug": "classicpress",
          "web_url": "https://directory.classicpress.net/developers/classicpress",
          "username": null,
          "website": "https://classicpress.net",
          "published_at": "2021-07-28 22:43:26"
        },
        "slug": "classic-commerce",
        "web_url": "https://directory.classicpress.net/plugins/classic-commerce",
        "minimum_wp_version": null,
        "minimum_cp_version": "1.0.0",
        "current_version": "1.0.4",
        "latest_cp_compatible_version": null,
        "git_provider": "GitHub",
        "repo_url": "https://github.com/ClassicPress-plugins/classic-commerce",
        "download_link": "https://github.com/ClassicPress-plugins/classic-commerce/releases/download/1.0.4/classic-commerce.zip",
        "comment": "",
        "type": {
          "key": "CP",
          "value": 0,
          "description": "Developed for ClassicPress"
        },
        "published_at": "2021-07-28 22:43:26"
      }
    ],
    "published_at": "2021-07-28 22:43:26"
  }
}

The decoded response data object propertiesLink to this section

  • name The name of the Developer.
  • slug The slug of the Developer.
  • web_url The URL of the Developer on the ClassicPress Repository.
  • username The Forum Username of the Developer.
  • website The Website of the Developer.
  • plugins An array of Objects, each object describing a plugin developed by the Developer. Properties of the Plugin Objects are exactly the same as when retrieving a Plugin.
  • published_at When the Developer profile was published.

Plugins API EndpointLink to this section

URL: https://directory.classicpress.net/api/plugins

You can retrieve a paginated list of all published plugins. The response will hold a JSON Object holding the Plugin Information as seen in the below.

URL: https://directory.classicpress.net/api/plugins/{slug}

The {Slug} represents the Plugin Name (slug).

You can retrieve informations about each published ClassicPress Plugin. The response will hold a serialised array of Developer Information as seen in the below example:

{
  "data": {
    "name": "Classic Commerce",
    "description": "A simple but powerful e-commerce platform, forked from WooCommerce, built for ClassicPress.",
    "developer": {
      "name": "ClassicPress",
      "slug": "classicpress",
      "web_url": "https://directory.classicpress.net/developers/classicpress",
      "username": null,
      "website": "https://classicpress.net",
      "published_at": "2021-07-28 22:43:26"
    },
    "slug": "classic-commerce",
    "web_url": "https://directory.classicpress.net/plugins/classic-commerce",
    "minimum_wp_version": null,
    "minimum_cp_version": "1.0.0",
    "current_version": "1.0.4",
    "latest_cp_compatible_version": null,
    "git_provider": "GitHub",
    "repo_url": "https://github.com/ClassicPress-plugins/classic-commerce",
    "download_link": "https://github.com/ClassicPress-plugins/classic-commerce/releases/download/1.0.4/classic-commerce.zip",
    "comment": "",
    "type": {
      "key": "CP",
      "value": 0,
      "description": "Developed for ClassicPress"
    },
    "published_at": "2021-07-28 22:43:26"
  }
}

The decoded response data object propertiesLink to this section

  • name The name of the plugin.
  • description The Plugin short description.
  • developer An object with the data of the Developer. Properties of the Developer Object are the same as when retrieving a Developer, without the Plugins array.
  • slug The Slug of the Plugin.
  • web_url The URL of the Plugin on the ClassicPress directory.
  • minimum_wp_version The minimally required WordPress version.
  • minimum_cp_version The minimally required ClassicPress version.
  • current_version The current version (stable) of the Plugin.
  • latest_cp_compatible_version The last version of the Plugin that was compatible with ClassicPress.
  • git_provider The Git Provider. Currently only GitHub Supported.
  • repo_url Remote Repository (Currently only GitHub Supported) URL.
  • download_link Stable release download link on remote repository.
  • comment Comment added by Developer when submitting the Plugin to the ClassicPress Directory.
  • type Object describing the Type of Plugin. The Object’s properties are:
    key For what platform the Plugin was developed. Defaults to CP, accepts CP or WP.
    value How the value is stored in the database
    description Description of the Type. Defaults to “Developed for ClassicPress”.
  • published_at When the Developer published this plugin.

Integration example with ClassicPress/WordPressLink to this section

There are many ways to get a response from an API, if you are using ClassicPress (perhaps you are creating a plugin to display some data about ClassicPress Plugins or Developers), you can get the response with following functions. We will use the ClassicPress Developer as an example.

Step One – GET a responseLink to this section

Use wp_remote_get to get the API response. Example:

$developer = 'classicpress';
$response = wp_remote_get( 'https://directory.classicpress.net/api/developers/' . $developer  );

Step Two – Check for the response Status CodeLink to this section

Check if the response status is 200 OK using wp_remote_retrieve_response_code like so:

if( wp_remote_retrieve_response_code( $response ) === 200 ){
  // The response status is 200 OK
}

Retrieve the Response BodyLink to this section

Retrieve the response Body using wp_remote_retrieve_body like so:

$response_body = wp_remote_retrieve_body( $response );

Then decode the response using json_decode. Do not forget to stripslashes the response body before decoding it. Example:

$decoded_response = json_decode( stripslashes( $response_body ) );

You now have an Object at disposal with a property data in turn holding the information about this developer we just retrieved. Properties of the data object are explained in the Developers API endpoint and Plugins API endpoints respectively.