Dashboard > WSO2 Mashup Server > ... > WSO2 Mashup Server Reference > APPClient Host Object
  WSO2 Mashup Server Log in | Register   View a printable version of the current page.  
  APPClient Host Object
Added by Thilina Gunarathne , last edited by Thilina Gunarathne on Jul 13, 2007  (view change)
Labels: 
(None)

1.0 Introduction

A Mozilla Rhino based javascript host object to act as a client to an APP server as defined in the APP specification.

1.1 Example

This example demonstrates posting an blog entry to a blog hosted at blogger using a java script object.

var client = new APPClient();
client.credentials({username:"username",password:"password",service:"blogger"});
var entry = client.post("http://www2.blogger.com/feeds/xxxxxx/posts/full",{
					title:"test post",
					summary:"This is the summary",
					updated:"now",
					author:"yourname",
					content:<div xmlns="http://www.w3.org/1999/xhtml"><p>This is a test post from WSO2 Mashup Server APPClient.</p></div>
					});

This example demonstrates posting an blog entry to a blog hosted at blogger using the AtomEntry host object.

var atomEntry = new AtomEntry();
atomEntry.title="Test Post";
atomEntry.summery="summary";
atomEntry.updated="now"; //use 'now' to indicate current time
atomEntry.author="yourname";
atomEntry.content=<div xmlns="http://www.w3.org/1999/xhtml"><p>This is a test post from WSO2 Mashup Server APPClient.</p></div>;

var atomEntry =client.post("http://www2.blogger.com/feeds/xxxxxxx/posts/full",atomEntry);

2.0 APPClient Object

2.1 APPClient Interface

{
    Constructor APPClient();
    function AtomEntry get(string AtomEntryURI|AtomEntry entryObject);
    function AtomEntry post(string postURI,{AtomEntry entry|object entry});
    function void put(optional string editURI, {AtomEntry entry|object entry});
    function void deleteEntry(string AtomEntryURI|AtomEntry entryObject);
    function void credentials(object credentials);
    property object credentials;
}

2.2 API Documentation 

Member Description Supported in version
Constructor APPClient();

0.1
AtomEntry get(string AtomEntryURI | AtomEntry entryObject); Get an AtomEntry from the APPServer. Expects an Atom entry URI or an AtomEntry object as the arguments.

var entry = client.get("http://www.blogger.com/feeds/000/posts/full/000");
0.1
AtomEntry post(string postURI,
{AtomEntry entry | object entry});
Posts an AtomEntry object in to an APP server using the given post URI as mentioned in the APP specification.

Entry to be posted can be given as a AtomEntry object as well as a javascript object with following properties defined.

  • string author|string authors (comma separated list)
  • string category|string categories(comma separated list)
  • XML content | string content
  • string contributor|string contributors(comma separated list)
  • string id
  • string link|string links(comma separated list)
  • string published (supports value 'now' to specify the current time)
  • XML rights|string rights
  • XML summary | string summary
  • XML title | string title
  • string updated : can put the value as'now' to specify the current time
0.1
 void put(optional string editURI,
{AtomEntry entry|object entry});
Puts an AtomEntry object in to a APP server using the given edit URI as mentioned in the APP specification.
Entry to be put can be given as a AtomEntry object as well as a javascript object with following properties defined.
  • string author|string authors (comma separated list)
  • string category|string categories(comma separated list)
  • XML content|string content
  • string contributor|string contributors(comma separated list)
  • string id
  • string link|string links(comma separated list)
  • string published : can put the value as'now' to specify the current time
  • XML rights|string rights
  • XML summary | string summary
  • XML title | string title
  • string updated : can put the value as'now' to specify the current time
0.1
 void deleteEntry(string AtomEntryURI | AtomEntry entryObject); Deletes the AtomEntry designated by the URI or by the AtomEntry object from the APPServer.
    client.delete("http://www.blogger.com/feeds/000/posts/full/000");
 
void credentials(object credentials); This can be used to provide a JavaScript object with the username,password and authentication service credentials to the APPServer. Currently this supports blogger authentication only.

client.credentials({username:"you@email.com",password:"xxx",service:"blogger"});
0.1 (will be deprecated in 0.2)
property object credentials; This property can be used to provide a JavaScript object with the username,password and authentication service credentials needed to communicate with APPServer. Returns the credentials object if it's already set or null otherwise.
  • Currently this supports blogger authentication only.

    client.credentials={username:"you@email.com",password:"xxx",service:"blogger"};
0.2

Powered by a free Atlassian Confluence Open Source Project License granted to WSO2 Inc.. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators