Use API Parameters to Run an Agent
June 23, 2016
This walkthrough uses the Agent.Run API call to demonstrate how to pass parameters through an API call to an agent. These can be replicated for any API call.
To use Mozenda Rest API, you must first generate a web service key.
To begin, we recommend using a simple text editor such as Notepad so that you can see the entire URL on a single line.
- Copy and paste the first part of the API call into a text editor: https://api.mozenda.com/rest?
- Insert WebServiceKey= and your web service key (the one below is an example key).
- Insert &Service=Mozenda10&Operation= after the key.
- Insert the
Agent.RunAPI call. As the name implies, the
Agent.Runcall will start a new job for the agent. Running this call will require the agent ID and any parameters built into the agent. For a full synopsis, see the Agent.Run API page.
- Enter &AgentID= after Agent.Run.
- Find the agent ID for the agent you want to run, and enter it after &AgentID=. To find the agent ID, log in to the Web Console, go to the Agents tab, and look at the ItemID next to the agent you’d like to run.
Identify one of the parameters in the agent. You may need to open the agent in the Agent Builder to look for any Set User Input actions with an input value that appears between two percent signs. It would look something like this:
- Insert &AgentParameter. followed by the parameter name and value.
- Repeat step 8 for any additional parameters in the agent. The completed API call should look something like this:
To test this API call, copy the API call you’ve assembled and paste it into a browser, then press Enter. Depending on the browser you choose, the response may be shown differently, but it should look something like this:
<Result>Success</Result> indicates not that the agent has completed the job, but that the job has successfully started.