RSStoBlog API HOW-TO Copyright © RSStoBlog. All Rights Reserved.

Transcription

RSStoBlog API HOW-TO Copyright © RSStoBlog. All Rights Reserved.
RSStoBlog API HOW-TO
Copyright © RSStoBlog. All Rights Reserved.
GENERAL INFORMATION
For testing or working with the API you have to write a program to access the
API file located in your RSS to Blog folder
http://www.yourdomain.com/RSS2B4/rsstoblog.php
All versions of RSS to Blog 4.0.5 and up will have this file.
The file rsstoblog.php is just like the xmlrpc.php file shipped with wordpress. It
is the file that your program needs to communicate with, using the API methods
contained in this document.
Copyright © RSStoBlog. All Rights Reserved.
PROGRAMMATIC INTERFACES
Following are the XML-RPC methods supported by RSStoBlog. You can use any
language that supports XML-RPC calls to use these methods e.g. php or C#
•
rsstoblog.sayGreeting
Description: Say greeting message.
Parameters: none
Return value: on success, always return String “Howdy!”
•
rsstoblog.newTextPod
Description: Creates a new Text Pod.
Parameters: String username, String password, String podName, String
podData
Return value: on success, return String ID of new Text Pod; on failure,
fault
•
rsstoblog.newLinkPod
Description: Creates a new LinkPod.
Parameters: String username, String password, String linkpodName, String
linkpodData
Return value: on success, return String ID of new LinkPod; on failure,
fault
•
rsstoblog.newTemplate
Description: Creates a new Template.
Parameters: String username, String password, String templateName, String
templateData
Return value: on success, return String ID of new Template; on failure,
fault
•
rsstoblog.newPingServer
Description: Creates a new ping url.
Parameters: String username, String password, String pingURL
Copyright © RSStoBlog. All Rights Reserved.
Return value: on success, return String ID of new ping server; on failure,
fault
•
rsstoblog.newProfile
Description: Creates a new profile.
Parameters: String username, String password, String profileName, String
blogTitle, String blogUser, String blogPass, String blogType [BLOGGER,
TYPEPAD, WORDPRESS, MOVABLE, LIVEJOURNAL, MSNSPACES] ,
boolean sendPing, String pingBlogName, String pingURL, String blogHost,
String blogPath, String blogPort
Return value: on success, return String ID of new profile; on failure, fault
•
rsstoblog.newProject
Description: Creates a new project.
Parameters: String username, String password, Array init, Array search,
Array news, Array rss, Array pod, Array templateIDs, Array random, Array
additional, Array options
Array init = { String projectName, boolean status, Array profileIDs, String
postToProfile [POST_TO_ONE_PROFILE , POST_TO_ALL_PROFILE],
String postType [SEARCH, NEWS, RSS, POD, RANDOM] }
Array search = { boolean Google, boolean Yahoo, boolean MSN, boolean
noLink, boolean bold, boolean italic, boolean normal, String linkText, String
resultFrom, String resultTo, String keywords }
Array news = { boolean Google, boolean Yahoo, boolean MSN, boolean
noLink, boolean bold, boolean italic, boolean normal, String linkText, String
resultFrom, String resultTo, String keywords }
Array rss = { boolean noLink, boolean bold, boolean italic, boolean normal,
String linkText, String resultFrom, String resultTo, String feeds, String
search }
Array pod = { String podPost [RANDOM, SEQUENTIAL], String
endSequence [ LOOP, NOLOOP], String email, Array podIDs }
Array random = { boolean search, boolean news, boolean rss, boolean pod }
Copyright © RSStoBlog. All Rights Reserved.
Array additional = { String podPost [RANDOM, SEQUENTIAL], String
endSequence [ LOOP, NOLOOP], String position [BEGINNING, END],
String email, Array podIDs }
Array options = { boolean nofollow, boolean saveAsdraft, boolean
linksInNewWindow, boolean addTitleToPost, String linkpodID, String
boldKeywords, boolean useOnlyKeywordsInTitle, String keywordPosition
[ BEGINNING, MIDDLE, END, RANDOM] , String keywords, String
randomSend [ EVERY_30_60_MINUTES, EVERY_1_2_HOURS,
EVERY_3_4_HOURS, EVERY_4_8_HOURS, EVERY_9_12_HOURS,
EVERY_14_18_HOURS, EVERY_19_24_HOURS, EVERY_2X_PERDAY,
EVERY_4X_PERDAY, EVERY_6X_PERDAY, EVERY_2_DAYS,
EVERY_3_DAYS] , String postPerRun }
Return value: on success, String projectID; on failure, fault
LIST METHODS
•
rsstoblog.listTemplate
Description: List available templates.
Parameters: String username, String password
Return value: on success, return Array with index as the template IDs
while template name as values; on failure, fault
•
rsstoblog.listProfile
Description: List available profiles
Parameters: String username, String password
Return value: on success, return Array with index as the profile IDs while
profile name as values; on failure, fault
•
rsstoblog.listProject
Description: List available projects.
Parameters: String username, String password
Return value: on success, return Array with index as the project IDs while
project name as values; on failure, fault
Copyright © RSStoBlog. All Rights Reserved.
•
rsstoblog.listPod
Description: List available Pods.
Parameters: String username, String password
Return value: on success, return Array with index as the pod IDs while
pod name as values; on failure, fault
•
rsstoblog.listLinkPod
Description: List available Link Pods.
Parameters: String username, String password
Return value: on success, return Array with index as the linkpod IDs
while linkpod name as values; on failure, fault
Copyright © RSStoBlog. All Rights Reserved.
EXAMPLES
You can use any language that supports xmlrpc based calls to remote server. In
order to make things easier I’ve used an existing xmlrpc library. The following
examples uses php and Incutio XML-RPC library (IXR) which can be downloaded
from http://scripts.incutio.com/xmlrpc/IXR_Library.inc.php.txt
Example 1: Say Howdy!
Let’s start with a simple example. There is a method in API to test connectivity
and see if things are working, it’s called rsstoblog.sayGreeting. It doesn’t take
any parameters and returns a message back from server.
<?php
//include the downloaded library
include('IXR_Library.inc.php');
// pass the url for your rsstoblog.php
$cl = new IXR_Client('http://yourdomain.com/RSS2B4/rsstoblog.php');
if (!$cl->query('rsstoblog.sayGreeting')) {
die('error: '.$cl->getErrorCode().":". $cl->getErrorMessage());
}
// if successful this will print a message "Howdy!"
print $cl->getResponse();
?>
Copyright © RSStoBlog. All Rights Reserved.
Example 2: Adding New Text Pod!
Let’s see how to add a new text pod to the system. Checkout signature for method
rsstoblog.newTextPod before moving forward.
<?php
//include the library
include('IXR_Library.inc.php');
// pass the url for your rsstoblog.php
$cl = new IXR_Client('http://yourdomain.com/RSS2B4/rsstoblog.php');
$param = array();
$param[] = 'admin';
$param[] = 'admin';
$param[] = 'Pod Name';
//RSStoBlog username
//RSStoBlog password
//Text Pod Name
// Text Pod data
$param[] = '#TITLE# test title #/TITLE# Test Message #BREAK#';
if (!$cl->query('rsstoblog.newTextPod',$param)) {
die('error: '.$cl->getErrorCode().":" . $cl->getErrorMessage());
}
// if successful this will print id for newly added Text Pod
print $cl->getResponse();
?>
Copyright © RSStoBlog. All Rights Reserved.
Example 3: Adding New Profile
Now let’s see how to add a new profile. Have a look at the signature for
rsstoblog.newProfile method and see what is required in order to move
forward.
<?php
//include the library
include('IXR_Library.inc.php');
// pass the url for your rsstoblog.php file
$cl = new IXR_Client('http://yourdomain.com/RSS2B4/rsstoblog.php');
$param = array();
$param[]
$param[]
$param[]
$param[]
$param[]
$param[]
$param[]
$param[]
$param[]
$param[]
$param[]
$param[]
$param[]
=
=
=
=
=
=
=
=
=
=
=
=
=
'admin';
//RSStoBlog username
'admin';
//RSStoBlog password
'Test Profile';
//Name for profile
'My Blog Title';
//blog Title
'blogusername';
//blog user
'blogpassword';
//blog password
'BLOGGER';
//Type of Blog Profile
true;
//want to send ping?
'MY Blog Ping';
//Ping Title
'http://mydomain.com/';
//Ping URL
'';
//Rest are for wordpress/movableType so pass ''
'';
'';
if (!$cl->query('rsstoblog.newProfile',$param)) {
die('error: '.$cl->getErrorCode().":" . $cl->getErrorMessage());
}
/* If successful this will print the id for new profile, try checking
out the profile list at http://yourdomain.com/RSS2B4/profile.php, you
will see newly added profile over there */
print $cl->getResponse();
?>
Copyright © RSStoBlog. All Rights Reserved.