just_a_dude has the Authentication part, but the xml in his sample doesn't work with the current 12sprints API, and it shouldn't be Base64 encoded. Here's a modified version of his sample that works (just change the username/password):
// the xml we want to send to the server
var xml:String = "<activity name=\"New activity using cURL\"></activity>"
var bytes:ByteArray = new ByteArray();
bytes.writeUTFBytes(xml);
// encoded credentials
var credentials:Base64Encoder = new Base64Encoder();
credentials.encode("[email protected]:pass");
var request:URLRequest = new URLRequest("https://beta.12sprints.com/v1/activities");
request.data = bytes;
request.method = URLRequestMethod.POST;
request.requestHeaders.push(new URLRequestHeader("Authorization", "Basic " + credentials));
request.requestHeaders.push(new URLRequestHeader("Content-Type", "application/xml"));
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
loader.load(request);
}
protected function completeHandler(event:Event):void {
trace("complete");
}
protected function errorHandler(event:Event):void {
trace("error : ", event);
var loader:URLLoader = event.currentTarget as URLLoader;
trace(loader.data);
}