Agent.Add
  • 14 May 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Agent.Add

  • Dark
    Light
  • PDF

Article summary

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.

NameRequiredTypeDescription
NameTruestringName for the new agent.
DefinitionTruefileThe XML definition of the agent to be added.
DescriptionFalsestringDescription for the new agent.
BrowserIsolationFalsebooleanTrue 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

NameTypeDescription
ResultstringSuccess if the operation was successful.
AgentIDnumericUnique identifier for the agent created.
CollectionIDnumericUnique 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
    }
  }
}

Was this article helpful?

What's Next