eLert Gadget
GOT SOMETHING IMPORTANT TO SAY? ...
Your Hotline to Readers' Desktops
API Documentation

Getting Started

In order to submit your API application please create publisher account here.
Once logged in go to >> SET UP >> DEVELOPERS

eLert Gadget have begun development on an API application to allow third party sites and scripts to access our services.

The api url address is: http://www.elertgadget.com/elertAPI.php

To be able to get or set data you will need to login first through the API. After session expires, you have to login again.

Date format of the requests are responses is: YYYY-MM-DD HH-MM-SS

The API response format is always XML, and the request method is POST.

Methods

The API supports the following methods to send and receive eLert data:


Login

Returns back valid session id if the login was successful.
This method also returns all user social accounts and all blogs

URL:
http://www.elertgadget.com/elertAPI.php

Requires Authentication:
no

HTTP Method:
post

POST Parameters:
  • username: valid elertgadget username
  • password: valid elertgadget password
  • secret: valid application secret
  • apiAction: login


XML Response:
<?xml version='1.0' encoding='UTF-8'?>
<Result>
	<Login>
		<Session id='747ffffee7c50215ff4c05df716aa8fc' />
		<User>
			<name>Twitter</name>
		</User>
	</Login>
	<SocialAccounts>
		<Account id='1206'>
			<Name>twitter</Name>
			<Username>twitter111</Username>
		</Account>
		<Account id='374'>
			<Name>myspace</Name>
			<Username>myspace111</Username>
		</Account>
		<Account id='995'>
			<Name>facebook</Name>
			<Username>facebook111</Username>
		</Account>
	</SocialAccounts>
	<Blogs>
		<Blog id='5053'>
			<Name>My Wonderful Blog</Name>
		</Blog>
		<Blog id='4990'>
			<Name>My Test Blog</Name>
		</Blog>
	</Blogs>
</Result>



Get blog entries list

Returns all user blogs ids and all blog entries ids


URL:
http://www.elertgadget.com/elertAPI.php

Requires Authentication:
yes

HTTP Method:
post

POST Parameters:
  • session_id: valid elertgadget session id received from login method
  • blog_id: this is blog id, by default is "0" which returs back all blog ids and their posts ids
  • apiAction: getBlogEntriesList


XML Response:
<?xml version='1.0' encoding='UTF-8'?>
<Result>
	<Blog id='4990'>
		<Entry id='470162' />
	</Blog>
	<Blog id='5053'>
		<Entry id='470161' />
	</Blog>
</Result>


Get blog entries

Returns all user blog entries after specified date


URL:
http://www.elertgadget.com/elertAPI.php

Requires Authentication:
yes

HTTP Method:
post

POST Parameters:
  • session_id: valid elertgadget session id received from login method
  • time: date time format YYYY-MM-DD HH-MM-SS
  • apiAction: getEntries


XML Response:
<?xml version='1.0' encoding='UTF-8'?>
<Result>
<RequestTime>2010-04-13 13-41-39</RequestTime>
	<BlogEntries>
	<Entry id='470162'>
		<modifytime>2010-04-13 13:39:42</modifytime>
		<blog id='4990' />
		<headline><![CDATA[This is my second blog post]]></headline>
		<description><![CDATA[<p>This is my second blog post content</p><br />]]></description>
		<url><![CDATA[http://blogname.elertgadget.com/link_to_your_entry]]></url>
	</Entry>
	<Entry id='470161'>
		<modifytime>2010-04-13 13:39:19</modifytime>
		<blog id='5053' />
		<headline><![CDATA[This is first blog]]></headline>
		<description><![CDATA[<p>This is first blog content</p><br />]]></description>
		<url><![CDATA[http://blogname.elertgadget.com/link_to_your_entry]]></url>
	</Entry>
	</BlogEntries>
</Result>


Insert entry

Insert new blog entry in eLert Gadget database


URL:
http://www.elertgadget.com/elertAPI.php

Requires Authentication:
yes

HTTP Method:
post

POST Parameters:
  • session_id: valid elertgadget session id received from login method
  • blog_id: valid blog id (received from previous methods as login or getBlogEntriesList)
  • social_accounts: social account ids, separated with comma if more then one (social account ids are received from login method)
  • headline: this is entry headline
  • description: this is entry description
  • apiAction: new


XML Response:
<?xml version='1.0' encoding='UTF-8'?>
<Result>
	<Entry id='470163'>
	<createtime>2010-04-13 13-49-37</createtime>
	</Entry>
</Result>


Update entry

Update existing blog entry in eLert Gadget database


URL:
http://www.elertgadget.com/elertAPI.php

Requires Authentication:
yes

HTTP Method:
post

POST Parameters:
  • session_id: valid elertgadget session id received from login method
  • entry_id: valid entry id received from getBlogEntriesList or getEntries method
  • blog_id: valid blog id (received from previous methods as login or getBlogEntriesList)
  • social_accounts: social account ids, separated with comma if more then one (social account ids are received from login method)
  • headline: this is entry headline
  • description: this is entry description
  • apiAction: edit


XML Response:
<?xml version='1.0' encoding='UTF-8'?>
<Result>
	<Entry id='470163'>
	<createtime>2010-04-13 13-57-27</createtime>
	</Entry>
</Result>


Delete entry

Delete particular blog entry in eLert Gadget database


URL:
http://www.elertgadget.com/elertAPI.php

Requires Authentication:
yes

HTTP Method:
post

POST Parameters:
  • session_id: valid elertgadget session id received from login method
  • entry_id: valid entry id received from getBlogEntriesList or getEntries method
  • apiAction: delete


XML Response:
<?xml version='1.0' encoding='UTF-8'?>
<Result>
	<Entry id='470164'>
		<modifytime>2010-04-13 14-00-30</modifytime>
	</Entry>
</Result>


HTTP Response Errors

The eLert Gadget API attempts to return appropriate HTTP status codes for every request...
The list below are error codes and their descriptions:
  • 1000 - internal elertgadget.com error
  • 1001 - wrong request POST parameters
  • 1010 - session life time expired
  • 1011 - wrong login or password
  • 1020 - wrong time format or other time error
  • 1021 - unknown action
  • 1022 - wrong blog entry id
  • 1023 - wrong blog id
  • 1024 - user social account ids aren't correct
  • 1025 - wrong application secret
  • 1026 - post from wrong domain
  • 1027 - application is not active


Error Messages
When the eLert Gadget API returns error messages, it does so in XML format. For example, an error from an XML method might look like this:
<?xml version='1.0' encoding='UTF-8'?>
<Result>
	<Error id='1011' />
</Result>


Sample Code

Below is PHP sample code for login:
//api url
$url = 'http://www.elertgadget.com/elertAPI.php';

//post fields data
$post_fields = 'username=testuser&password=testpassword&secret=testsecret&apiAction=login';

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,4);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$post_fields);

//execute post
$result = curl_exec($ch);

//close connection
curl_close($ch);

echo $result;