AT&T Developer's Challenge Demo AJAX API CallerThe following code will make an HTTP GET request to the Developer's Challenge API and log the request. You can then view the results in the status tab of the Developers Challenge Facebook application. Simply past your application key below along with a Facebook ID (integer) and submit the request.
This example uses a client side implementation of the httpRequest object in JavaScript. It has been tested for IE7 or less and Firefox. You may use this code in your application if you choose but be aware that if creating a native FBML application Javascript is limited and you should look at the new FBJS API that Facebook has released. This code is offered under the open source license. To download the Javascript object see the bottom of this document. If you need more information on using the AJAX API then please contact us on the Developers Challenge Home Page Discussion Board.
| Your application Key [appKey] | |
| FaceBook User ID [fbid] | |
| Text Message [iText] | |
| Image Message [iImage] | |
| Video Message [iVideo] | |
| iRingTone Message [iRingTone] | |
function doRequest(){
myRequest=new clsDevChallengeAPI()}
myRequest.async=false;
myRequest.onSuccess=pass;
myRequest.onFailure=fail;
myRequest.appKey=[Your application key as string]
myRequest.fbid=[User Facebook ID as number]
myRequest.iText=[0=False | 1=True]
myRequest.iImage=[0=False | 1=True]
myRequest.iVideo=[0=False | 1=True]
myRequest.iRingTone=[0=False | 1=True]
myRequest.call()
function pass(){
Do something}
function fail(){Do something}
Instantiation: Var myCaller = new clsDevChallengeAPI()
Properties
.rootPath Root Path of Web Service, should not be changed. Set to http://www.developerschangle.com/attfb.asmx/msg by default .method Method of Call, should not be changed. Set to GET by default .async Make the call Asyncrously or not. Set to False by default. The web service is very quick in its response and setting Async to true and making multiple rapid calls may result in missed responses. .appKey You application key .fbid User Facebook ID as number .iText Set if text message has been sent, 1=true | 0 = False .iImage Set if image message has been sent, 1=true | 0 = False .iVideo Set if Video message has been sent, 1=true | 0 = False .iRingTone Set if RingTone redirect has been requested, 1=true | 0 = False .result Boolean indicating is last call was successfull
Events
.onSuccess Fires when call has completed and was successful. Set to function pointer .onFailure Fires when call has completed and failed. Set to function pointer .onLoading Standard HttpRequest Object State, set to function pointer .onLoaded Standard HttpRequest Object State, set to function pointer .onInteractive Standard HttpRequest Object State, set to function pointer
Methods
.call() Makes a call to the web service. Returns true or false on success of call when Async is set to False.
clsDevChallengeAPI Source Code