Agent.Add
August 10, 2015
Description
Adds a new Agent. Cannot be used to overwrite an existing Agent. The existing Agent must be deleted first using the Agent.Delete request.
Required parameters
Name, Definition (Needs to be attached as a file)
Optional parameters
Description
BrowserIsolation (‘Yes’, ‘No’ – Yes to run the Agent with isolated browsers. Default is No)
Returns
The AgentID and CollectionID for the new Agent if the request was successful.
Example request
string agentDefinitionfileName = @"C:TempAgentDefinition.xml"; //Path to the Agent definition file to be uploaded. string url = @"https://api.mozenda.com/rest?WebServiceKey=C70E1F84-E12B-4e73-B199-2EE6D43AF44E&Service=Mozenda10&Operation=Agent.Add&Name=MyTestAgent"; WebClient client = new WebClient(); byte[] responseBinary = client.UploadFile(url, agentDefinitionfileName); string response = Encoding.UTF8.GetString(responseBinary);
Example response
<?xml version="1.0" encoding="utf-8" ?> <AgentSaveResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Result>Success</Result> <AgentID>1009</AgentID> <CollectionID>1009</CollectionID> </AgentSaveResponse>