Pligg CMS API

For quite some time now, Pligg has included an API system with the CMS package. This API allows you to perform a few different actions like get your Pligg User ID number, find the site categories and their IDs, and even submit a story from a simple POST form. Today I’m going to explain all of these API functions, since it is something that we haven’t talked about much in the past even though it is one of the most interesting things that you can do with Pligg.

Warning: There are a couple reasons why enabling the API could be a bad thing. One reason is because there is no cooldown period for submitting queries, allowing users to submit a massive number of stories or attempt to try login credentials at unlimited rates. Another issue is that the post function (for submitting stories) doesn’t have any type of spam checking feature. I recommend only enabling the API’s post function if you are actively monitoring your website’s stories. We recognize that there are issues with the API and would love to get some input from our users on how to improve functions and what features need to be added. Leave a comment below to share your thoughts.

First lets talk about enabling the API functionality, because by default we have it disabled on all sites as a way to protect sites that don’t want to use it. To enable the API you will have to perform a very quick edit to a single file stored at /3rdparty/API/api.php. Search for the two lines that contain the text “REMOVE TO ACTIVATE”, delete the line, save the file, and upload it to your server.

Now that you have the API enabled you can make use if it through a series of POST variables:

  • List – Returns a category list in XML format
  • Login – Check if Pligg login credentials are valid
  • Ping – Check a Pligg website’s API status
  • Post – Submit a new story
  • Version – Get the Pligg API version

List


The list function will return a category  list for your website, as well as ID numbers for each category. These ID numbers will be needed when you go to use the Post function later on.

Arguments
&username={USERNAME}
(required) the username of a member account.

&password={PASSWORD}
(required) the password of a member account.

Example URL: http://DOMAIN.com/3rdparty/API/api.php?fn=list&username=demouser&password=demopass

Example Successful Response

<?xml version="1.0" encoding="UTF-8"?>
<categorylist>
    <cate>
        <id>1</id>
        <name>Automative</name>
    </cate>
    <cate>
        <id>2</id>
        <name>Finance</name>
    </cate>
</categorylist>


Login


The login function is useful if you want to check if the account credentials provided are valid. When the username and password provided are correct it will return a unique user ID number. On failure it will return a zero (0).

Arguments
&username={USERNAME}
(required) the username of a member account.

&password={PASSWORD}
(required) the password of a member account.

Example URL: http://DOMAIN.com/3rdparty/API/api.php?fn=login&username=demouser&password=demopass


Ping


Ping is one of the simplest function provided because it doesn’t have any arguments. It will return a response of “Active” to indicate that the site is online and the API is enabled.

Example URL: http://DOMAIN.com/3rdparty/API/api.php?fn=ping


Post


The post function is the most complicated because it has so many variables. It is also the most useful because it can be used to submit stories to a site from a third party website by submitting a simple POST form.

Arguments
&username={USERNAME}
(required) the username of a member account.

&password={PASSWORD}
(required) the password of a member account.

&url={URL}
(required) the url associated with the story that you are submitting. This is what you typically put in the first submit step on Pligg websites.

&category={CATEGORY_ID_#}
(required) the ID number for the category that you are submitting to. To retrieve the category ID see the list function above.

&title={TITLE}
(required) the title of story being submitted.

&content={CONTENT}
(required) the content for the story being submitted.

&tags={TAGS}
(required) tags for the story separated by commas ( , )

Example URL: http://DOMAIN.com/3rdparty/API/api.php?fn=post&username=demouser&password=demopass&url=http://google.com&category=1&title=Hello World&content=Story Description&tags=tag1,tag2

On Success: Submit complete!
On Failure: Duplicate Story!!!


Version


The version function is used to return the Pligg API version number. A successful response will be a number, often with a decimal place.

Example URL: http://DOMAIN.com/3rdparty/API/api.php?fn=version

2 thoughts on “Pligg CMS API

  1. Hello,

    Is it possible to add my Pligg site to addthis or sharexy by implementing this API.

    For example, when one of the users find a good story and wants to share it on facebook and twitter, digg, delicious, etc, they can easily do it.

    Is it possible to do it the same way in Pligg?

    Thanks a lot

Comments are closed.