![]() |
|
OVERVIEW |
INSTALLATION |
EVALUATION |
PURCHASE |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SUPPORT |
API |
USAGE |
MONITORING |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
APIThe API (Application Programming Interface) consists of a set of methods each of which are formed in the body of an HTTP request. The applicable URL contains the IP address of the machine that ARCS is installed on as well as and your
specific ApplicationID, e.g. http://192.44.11.181:8080/MyApp. (The ApplicationID is specified during Setup.)
The basic idea is that you begin an ARCS session on behalf of some user of your application. You then bind some specified resource for that user, the user somehow utilizes the resource in your application for some period of time, and then you release the resource when finished. While the resource is bound, it cannot be bound by any other user (unless you specify some Capacity greater than 1 for, e.g. user counting). However, when applicable (see Threshold below), the resource can be bound by some other user if the original user hasn't checked-in "recently". Applications do indeed crash and when such is the case, the user should not be allowed to continue binding some resource if another user does actually try to bind that same resource. Keep in mind that a resource may be any abstract thing. To ARCS, it is simply an identifier for something that it aptly "protects". The following table lists all of the method calls and all possible arguments.
ArgumentsThe arguments are described before the methods because the descriptions of the methods make more sense after knowing what all of the arguments mean. UserID (string) ResourceID (string) Threshold (non-negative integer or float) Capacity (integer) MethodsBegin - Begin a new session for some user. Arguments: UserID, {Threshold} Result:
Bind - Bind a resource for some user. Arguments: UserID, ResourceID, {Capacity}, {Data} Result:
Release - Release a resource for some user. Arguments: UserID, ResourceID Result:
CheckIn - Check-in with the server and update the activity-timestamp for the passed user. All other methods update the activity-timestamp as well. This method is typically called on a timer (in your application) having an interval that is less than or equal to the threshold passed to Begin. Basically, it is called to show that the user's application hasn't crashed; this is intended to ensure that the user session is not wiped out upon some other user attempting to bind a resource this user has bound. A server hosting multiple users, e.g. a web server, may call CheckIn on behalf of its users when such users check-in with it. Arguments: UserID Result:
Info - Retrieve information about some user and the resources for that user. Arguments: {UserID}, {ResourceID} If no UserID is passed or it is passed as an empty string, it is implied to be all of the current users. If no ResourceID is passed or it is passed as an empty string, it is implied to be all of the current resources. Result: There are three elements in the result.
End - End the session for some user. Arguments: UserID Result:
Example - Sequence of StepsThe following table exemplifies a typical simple sequence of steps.
ProtocolsThere are 3 different protocols that can be used in the requests/responses in the HTTP body. They all have the same breadth of functionality and behavior. Use the one that is most convenient for you. Contact info@arcs.us if you have a need for a reasonable protocol that is not listed below. 1) Basic (note: The example above was written using the Basic protocol.) [Request]: [Response]: 2) SOAP [Request]: <?xml version="1.0"?>
<SOAP-ENV:Envelope SOAP- [Response]: 3) FormPost [Request]: Method=Begin&UserID=MyUserA&Threshold=600 [Response]: Timestamps:For all of the protocols, timestamps are of the following format, consisting of 23 characters:ccyy-mm-ddThh:mm:ss.sss Example: 2006-02-19T20:34:41.434 This is a valid format of the XML Schema “dateTime” primitive datatype. More on the Info methodIt may be helpful to refer to the description of the result of Info under the section Methods.Applicable to the Basic and FormPost protocols: The result elements (the three elements that are described above under Methods) are delimited from each other by two sets of carriage-return/line-feed (4 characters in total). The second and third elements each delimit their respective rows with carriage-return/line-feed and delimit their respective columns with a tab character. It is recommended that you try it out for yourself to see how the result looks. The SOAP protocol can be understood by following the example below (the SOAP wrapper is omitted there, for clarity). Example - Info method using the SOAP protocol: [Request]: [Response]:
Example - Simplified CodeYou should be able to copy/paste the following pseudo-code and make the necessary adjustments to get something working very quickly.url = "http://192.44.11.181:8080/MyApp" http = new ActiveXObject("Microsoft.XMLHTTP") user = "UserA" threshold = 600 request = "Begin" + "\n" + user + "\n" + threshold http.open("POST", url, false) http.setRequestHeader("Content-Type", "text/plain") http.send(request) response = http.responseText // you should then check on the success of this result request = "Bind" + "\n" + user + "\n" + "MyResourceN" http.open("POST", url, false) http.setRequestHeader("Content-Type", "text/plain") http.send(request) response = http.responseText // you should then check on the success of this result |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
© Littlearth, Inc. 2007. All rights reserved.
Web design by Helen Lee