Documentation
From M3:DEV
Contents |
[edit]
Introduction
[edit]
Bb Client
Example client using jQuery
Before you connect to the server you need to create you XML request. If you are nor familiar with XML, please visit the W3C Schools for tutorials on basic XML.
XML Request Structure
<?xml version="1.0" encoding="ISO-8859-1"?> <SERVER_REQUEST> <API_KEY></API_KEY> //required <NAMESPACE></NAMESPACE>//required <METHOD></METHOD> //required <PARAMETERS> <PARAMETER> <NAME></NAME> <VALUE></VALUE> </PARAMETER> </PARAMETERS> </SERVER_REQUEST>
when formulating a request you will need to supply an API_KEY, NAMESPACE and METHOD you are calling on the server.
- API_KEY - Generated by the server during the login process
- NAMESPACE - The name space is required so the server knows what APIs you are calling. For instance Bb CMS might have a class called users, but another application named QuD has a class of the same name. To separate these classes we use name spaces. If you want to access the Bb version of the users class you would set the name space to "brikerbrak". To access the QuD users class your name space would need to be set to "qud".
- METHOD - Methods on the server can be called by one or two parameters. You can specify just the class and allow the server to run the default method or you can specify a class method to run.
- <METHOD>workcue</METHOD> - Run default Method
- <METHOD>workcue::getCompletedJobs</METHOD> - Call a specific method
- Parameters are formatted in name/value pairs. This allow the flexibility list parameters in any order and allow the class to sort out the details.
Complete XML request
<?xml version="1.0" encoding="ISO-8859-1"?> <SERVER_REQUEST> <API_KEY>123456</API_KEY> <NAMESPACE>qud</NAMESPACE> <METHOD>workcue</METHOD> <PARAMETERS> <PARAMETER> <NAME>producer</NAME> <VALUE>phenbach</VALUE> </PARAMETER> </PARAMETERS> </SERVER_REQUEST>
Basic jQuery Bb Client
This client creates a list open projects in the QuD Project Manager application
<html>
<head>
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var xmlDocument = '<SERVER_REQUEST>'+
'<API_KEY>123456</API_KEY>'+
'<NAMESPACE>qud</NAMESPACE><'+
'METHOD>workcue</METHOD>'+
'<PARAMETERS>'+
'<PARAMETER><NAME>producer</NAME><VALUE>phenbach</VALUE></PARAMETER>'+
'</PARAMETERS>'+
'</SERVER_REQUEST>';
$.ajax({
type: "POST",
url: "http://localhost/brikerbrak/",
processData: false,
data: xmlDocument,
success: function(xml){
$(xml).find('ITEM').each (function(){
var projectid=$(this).find('PROJECTID').text();
$('<li></li>').html(projectid).appendTo('#update-target ol');
});
}
});
});
</script>
</head>
<body>
<div id='update-target'>
<ol>
<li></li>
</ol>
</div>
</body>
</html>
[edit]
Bb Server
[edit]
Server Classes
[edit]
bb_apiServer
API request gateway for the BrikerBraK server. It performs user authentication and API basic security checks.
[edit]

