- Print
- DarkLight
- PDF
The REST API is available to all Enterprise customers.
To better understand how to use the Mozenda REST API, we have provided this getting started toolkit to walk you through the most commonly executed tasks of the API.
Web service key
To run API calls, you need a web service key. You can find this by following the instructions here.
Running projects
Run an agent
To run an agent, use Agent.Run. If you have parameters you would like to pass in to the agent, refer to the Agent.Run documentation.
https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&Service=Mozenda10&Operation=Agent.Run&AgentID=1039
AgentID
Sign in to the Web Console, go to the Agents tab, and look at the ItemID
next to the agent you’d like to run.
The call returns something similar to the following:
<?xml version="1.0" encoding="utf-8"?>
<AgentRunResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Result>Success</Result>
<AgentID>1003</AgentID>
<JobID>15852</JobID>
<JobType>WebPageHarvest</JobType>
<ReportRefreshJobID>15853</ReportRefreshJobID>
</AgentRunResponse>
The data is ready when both the harvest job (JobID
) and the refresh job (ReportRefreshJobID
) have a status of Done
. Use Job.Get or Job.GetStatus to check the current status.
https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&Service=Mozenda10&Operation=Job.GetStatus&JobID=15852
Run a sequence
A sequence creates a workflow that allows for more task automation than can be accomplished by a single agent.
To run a sequence, use Sequence.Run.
https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&Service=Mozenda10&Operation=Sequence.Run&SequenceID=1003
Sign in to the* Web Console* > select Sequences > Look at the ItemID
next to the sequence you’d like to run.
To check the status of the sequence, use Sequence.GetStatus. This operation returns information about the steps included in the sequence, including which step is currently running.
Getting data
Return items from a view
Use View.GetItems to access data that Mozenda has captured.
https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&Service=Mozenda10&Operation=View.GetItems&ViewID=1003
Sign into the Web Console > select Collections > select the collection you are interested in pulling from > hover over the view in the drop-down at the top right corner of the page.
If the view has more than 1000 items, this request returns 1000 items at a time.
Set a publisher and publishing
Through the API, you can alter the publisher where a collection publishes to. The options for the method of publishing are: Email, FTP, AmazonS3, AzureStorage, Dropbox, Google Cloud Storage, and Google drive. For more information about these methods and the parameters required for each, visit the Collection.SetPublisher documentation.
https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&Service=Mozenda10&Operation=Collection.SetPublisher&CollectionID=1099&Method=Email&EmailAddress=MyEmail@Provider.com
Sign into the Web Console > select Collections > look at the ItemID next to the collection you’d like to set the publisher for.
After you set a publisher for the collection, publish the data using Collection.Publish.