Agent.Add

Prev Next

Description

Adds a new agent. The existing agent must be deleted first using the Agent.Delete request.

Warning!

Cannot be used to overwrite an existing agent.

URL parameters

URL parameter ordering

The URL parameters below are listed in the order they should be entered in the API URL.

Name Required Type Description
Name True string Name for the new agent.
Definition True file The XML definition of the agent to be added.
Description False string Description for the new agent.
BrowserIsolation False boolean True to run the agent with isolated browsers. Default is False.

Request body

In order to use the Agent.Add, you will need to attach the Mozenda-made XML file that correlates with an agent.

Responses

Name Type Description
Result string Success if the operation was successful.
AgentID numeric Unique identifier for the agent created.
CollectionID numeric Unique identifier of the collection.

Sample request

curl -X POST "https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&Service=Mozenda10&Operation=Agent.Add&Name=API-Test&ResponseFormat=JSON" -F 'file=@/c/Politico.xml'

Sample responses

XML

<?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>

JSON (add &ResponseFormat=JSON)

{
  "AgentID": 1043,
  "CollectionID": 1063,
  "JsonResult": {
    "Command": "Agent.Add",
    "AutoLoggedIn": false,
    "WebConsoleKey": "",
    "Result": "Success",
    "ErrorCode": "",
    "ErrorDescription": "",
    "ErrorList": [],
    "ExecutionTime": {
      "Ticks": 0,
      "Days": 0,
      "Hours": 0,
      "Milliseconds": 0,
      "Minutes": 0,
      "Seconds": 0,
      "TotalDays": 0,
      "TotalHours": 0,
      "TotalMilliseconds": 0,
      "TotalMinutes": 0,
      "TotalSeconds": 0
    }
  }
}