How to call multiple XML APIs via single HTTP request
It is well known how to make a single XML API call using the HTTP GET method. This typically means typing the URL directly into the browser to call the API. Another way to call the XML API is by programmatically posting an XML document to the Adobe Connect Enterprise server.
However, it is not well known how to call multiple XML APIs via a single HTTP POST Method.
To call the multiple XML APIs, you need to post an XML document formatted in a certain fashion. The sample code snippet below shows the format.
<?xml version= "1.0" encoding= "utf-8" ?> <actions mode= "[multiple|multiple-complete|*]" > <action name= "principal-update" > <param name= "set-account-id" > 7 </param> <param name= "first-name" > User </param> <param name= "last-name" > 1 </param> <param name= "email" > user1@mycompany.com </param> <param name= "login" > user1@mycompany.com </param> <param name= "password" > foobar </param> <param name= "has-children" > false </param> <param name= "type" > user </param> </action> <action name= "principal-update" > <param name= "set-account-id" > 7 </param> <param name= "first-name" > User </param> <param name= "last-name" > 1 </param> <param name= "email" > user1@mycompany.com </param> <param name= "login" > user1@mycompany.com </param> <param name= "password" > foobar </param> <param name= "has-children" > false </param> <param name= "type" > user </param> </action> </actions>
The valid values for the mode attribute of the actions element are:
- multiple: Execute multiple actions even if there's an error from one of the actions. If there's an error in one of the actions, it just ignores the error and keeps executing the actions following it.
- multiple-complete: Execute only until each action succeeds. Stops executing the rest of the actions upon a failure.
- anything else: Execute multiple actions only if there's no error.
If an error is encountered, all the previous successful calls will be rolled back, resulting in no changes. In other words, your code must be error free. This is a transaction based execution mode.
This document must be posted to http://example.com/api/xml. Upon receiving this XML document, the Adobe Connect Enterprise Server will parse through this document and call each XML API in the order they appear in this document. For example, the above document instructs the Adobe Connect Enterprise Server to execute 'principal-update' twice for 2 different users.