<< <%SKIN-STRTRANS-SYNTOC%> >> Navigation: Programming Interface > Building a Web Application > Using Simple Web Requests |
The Content Grabber Windows service supports simple web requests, so you can execute agents and retrieve extracted data from non-Windows environments, such as from a PHP page on a Linux server.
The Windows service is listening for web requests on port 8004 by default. You can change this port number in the Content Grabber editor. The service is stopped by default and configured to start manually. If you are going to use this service, you should configure the service to start automatically. Please see Using the Content Grabber Agent Service for more information about the Windows service.
This is an example of a web request that executes an agent named Sequentum and provides some input values for the agent.
http://localhost:8004/ContentGrabber/RunAgentReturnJson?agent=sequentum&pars={"StartDate":"2015-10-15","EndDate":"2015-12-15"}
The above web request executes the agent synchronously and returns the extracted data as a JSON string.
The following functions are available when using web requests:
Function |
Description |
StartAgent?agent={agentNameOrPath}&sessionId={sessionId}&sessionTimeout={sessionTimeout}&runMethod={runMethod}&logLevel={logLevel}&logHtml={isLogHtml}&logToFile={isLogToFile}&pars={inputParameters}&key={key} |
Starts an agent that will run asynchronously.
This function supports both GET and POST requests. If you need to specify a long list of input parameters you must use POST requests, since GET requests are limited in length.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent will run in a session with the specified session ID.
sessionTimeout (optional): If the agent is running in a session, this value specifies the number of minutes the agent data will be available before it's deleted. The default session timeout is 30 minutes.
runMethod (optional): The run method specifies how an agent should be run, and must be one of the following values:
•Restart •Continue •ContinueAndRetryErrors
logLevel (optional): Log detail level. Set the log level to None to turn off logging. The default log level is None. Accepted values are None, Low, Medium and High.
logHtml (optional): Logs the raw HTML of all web pages processed by the agent. The default value is False.
logToFile (optional): Logs data to a file instead of a database table. The default value is False.
Pars (optional): A JSON formatted list of input values that can be used by the agent. The JSON string should be URL encoded.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
RunAgentReturnJson?agent={agentNameOrPath}&sessionId={sessionId}&runMethod={runMethod}&timeout={timeout}&logLevel={logLevel}&logHtml={isLogHtml}&logToFile={isLogToFile}&pars={inputParameters}&limit={limit}&key={key} |
Runs an agent synchronously and returns the extracted data as a JSON string.
The agent is always run in a session when the agent supports sessions, and the session is closed automatically after the agent has completed its run.
This function supports both GET and POST requests. If you need to specify a long list of input parameters you must use POST requests, since GET requests are limited in length.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
runMethod (optional): The run method specifies how an agent should be run, and must be one of the following values:
•Restart •Continue •ContinueAndRetryErrors
Timeout (optional): This maximum number of seconds an agent will run. When the timeout is reached, the agent will stop and close its session if it's run in a session. The default timeout is 30 seconds.
logLevel (optional): Log detail level. Set the log level to None to turn off logging. The default log level is None. Accepted values are None, Low, Medium and High.
logHtml (optional): Logs the raw HTML of all web pages processed by the agent. The default value is False.
logToFile (optional): Logs data to a file instead of a database table. The default value is False.
Pars (optional): A JSON formatted list of input values that can be used by the agent. The JSON string should be URL encoded.
Limit (optional): The maximum number of results to return.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
RunAgentReturnXml?agent={agentNameOrPath}&sessionId={sessionId}&runMethod={runMethod}&timeout={timeout}&logLevel={logLevel}&logHtml={isLogHtml}&logToFile={isLogToFile}&pars={inputParameters}&limit={limit}&key={key} |
Runs an agent synchronously and returns the extracted data as an XML string.
The agent is always run in a session when the agent supports sessions, and the session is closed automatically after the agent has completed its run.
This function supports both GET and POST requests. If you need to specify a long list of input parameters you must use POST requests, since GET requests are limited in length.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
runMethod (optional): The run method specifies how an agent should be run, and must be one of the following values:
•Restart •Continue •ContinueAndRetryErrors
Timeout (optional): This maximum number of seconds an agent will run. When the timeout is reached, the agent will stop and close its session if it's run in a session. The default timeout is 30 seconds.
logLevel (optional): Log detail level. Set the log level to None to turn off logging. The default log level is None. Accepted values are None, Low, Medium and High.
logHtml (optional): Logs the raw HTML of all web pages processed by the agent. The default value is False.
logToFile (optional): Logs data to a file instead of a database table. The default value is False.
Pars (optional): A JSON formatted list of input values that can be used by the agent. The JSON string should be URL encoded.
Limit (optional): The maximum number of results to return.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
StopAgent?agent={agentNameOrPath}&sessionId={sessionId}&key={key} |
Stops the agent if it is currently running asynchronously.
This function supports only GET requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent session you want to stop if the agent runs in sessions.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
CloseAgentSession?agent={agentNameOrPath}&sessionId={sessionId}&key={key} |
Closes an agent session after the agent has been run asynchronously. When you close an agent session, all data associated with that session is removed and you will not be able to retrieve status information about the agent that ran in this session. You can only close a session if an agent is not currently running in the session.
You don't need to close a session. Session data will be removed automatically after the agent has completed running and the session timeout has elapsed. The default session timeout is 30 minutes, so by default session data will be removed automatically 30 minutes after the agent has completed.
This function supports only GET requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId: The agent session you want to close.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
GetAgentProgressAsJson?agent={agentNameOrPath}&sessionId={sessionId}&key={key} |
Returns progress information as JSON about an agent running in a asynchronously. See below for more information about the information returned.
This function supports only GET requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent session if the agent runs in sessions.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
GetAgentLogAsJson?agent={agentNameOrPath}&sessionId={sessionId}&offset={offset}&limit={limit}&key={key} |
Returns log data as JSON for an agent that has been run asynchronously. This function does not return any data if logging is disabled or if logging is written to file. See below for more information about the information returned.
This function supports only GET requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent session if the agent runs in sessions.
offset (optional): Index of the first log entry to return.
Limit (optional): Index of the last log entry to return.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
GetAgentDataAsJson?agent={agentNameOrPath}&sessionId={sessionId}&offset={offset}&limit={limit}&key={key} |
Returns extracted data as a JSON string for an agent that has been run asynchronously.
This function supports only GET requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent session if the agent runs in sessions.
offset (optional): Index of the first data entry to return.
Limit (optional): Index of the last data entry to return.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
GetAgentDataAsXml?agent={agentNameOrPath}&sessionId={sessionId}&offset={offset}&limit={limit}&key={key} |
Returns extracted data as an XML string for an agent that has been run asynchronously.
This function supports only GET requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent session if the agent runs in sessions.
offset (optional): Index of the first data entry to return.
Limit (optional): Index of the last data entry to return.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
GetInfoForAllAgentsAsJson?directory={directory}&userName={userName}&password={password}&key={key} |
Returns all information about all agents in a specified directory. Username and password of a Windows user is required to retrieve scheduling information.
This function supports only GET requests.
Content Grabber can schedule agents using its internal scheduler or the Windows Task Scheduler. When using the Windows Task Scheduler a username and password of a Windows user is required to retrieve scheduling information. If username and password is not specified, this function returns scheduling information from the internal scheduler.
This function accepts the following parameters:
directory (required): The root directory of all agents to retrieve information from.
userName (required): The user name of a Windows account that can access scheduled tasks.
password (required): The password of a Windows account that can access scheduled tasks.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
GetAgentInfoAsJson?agent={agentNameOrPath}&sessionId={sessionId}&userName={userName}&password={password}&key={key} |
Returns all information about a specified agent. Username and password of a Windows user is required to retrieve scheduling information.
This function supports only GET requests.
Content Grabber can schedule agents using its internal scheduler or the Windows Task Scheduler. When using the Windows Task Scheduler a username and password of a Windows user is required to retrieve scheduling information. If username and password is not specified, this function returns scheduling information from the internal scheduler.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent session if the agent runs in sessions.
userName (required): The user name of a Windows account that can access scheduled tasks.
password (required): The password of a Windows account that can access scheduled tasks.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
GetAgentScheduleInfoAsJson?agent={agentNameOrPath}&sessionId={sessionId}&userName={userName}&password={password}&key={key} |
Returns scheduling information about a specified agent.
Content Grabber can schedule agents using its internal scheduler or the Windows Task Scheduler. When using the Windows Task Scheduler a username and password of a Windows user is required to retrieve scheduling information. If username and password is not specified, this function returns scheduling information from the internal scheduler.
This function supports only GET requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent session if the agent runs in sessions.
userName (required): The user name of a Windows account that can access scheduled tasks.
password (required): The password of a Windows account that can access scheduled tasks.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
GetAgentRuntimeInfoAsJson?agent={agentNameOrPath}&sessionId={sessionId}&key={key} |
Returns runtime information about a specified agent.
This function supports only GET requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent session if the agent runs in sessions.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
SetAgentSchedule?agent={agentNameOrPath}&isScheduleEnabled={isScheduleEnabled}&interval={interval}&intervalType={intervalType}&nextRunTime={nextRunTime}&logLevel={logLevel}&isLogToFile={isLogToFile}&userName={userName}&password={password}&isRunAsCurrentUser={isRunAsCurrentUser}&isRunOnlyWhenUserLoggedIn={isRunOnlyWhenUserLoggedIn}&key={key} |
Sets the schedule of a specified agent. Username and password of a Windows user is required to set a schedule.
Content Grabber can schedule agents using its internal scheduler or the Windows Task Scheduler. This function adds a schedule using the Windows Task Scheduler.
This function supports both GET and POST requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
isScheduleEnabled (required): Specifies if the scheduled task should be added or removed. If the agent is already scheduled, the scheduled task will be replaced if this parameter is true and removed if the parameter is false.
interval (required): The scheduled interval. This must be a positive integer value.
intervalType (required): The type of interval. Accepted values are Seconds, Minutes, Hours or Days.
nextRunTime (required): The first time to run the scheduled task.
logLevel (required): Log detail level. Set the log level to None to turn off logging. The default log level is None. Accepted values are None, Low, Medium and High.
logHtml (required): Logs the raw HTML of all web pages processed by the agent. The default value is False.
logToFile (required): Logs data to a file instead of a database table. The default value is False.
userName (required): The password of a Windows account that can access scheduled tasks.
password (required): The password of a Windows account that can access scheduled tasks.
isRunAsCurrentUser (required): This parameter should be set to false, and a user name and password of an existing Windows user should be used instead.
isRunOnlyWhenUserLoggedIn (required): Specifies if the agent should only run when the specified Windows user is logged in. This parameter should normally be set to false.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
AddAgentSchedule?agent={agentNameOrPath}&sessionId={sessionId}&logLevel={logLevel}logFilePath={logFilePath}&cron={cron}&startTime={startTime}&inputParameters={inputParameters}&key={key} |
Adds a schedule to a specified agent.
Content Grabber can schedule agents using its internal scheduler or the Windows Task Scheduler. This function adds a schedule using the internal scheduler.
This function supports both GET and POST requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent will run in a session with the specified session ID.
logLevel (required): Log detail level. Set the log level to None to turn off logging. The default log level is None. Accepted values are None, Low, Medium and High.
logFilePath (optional): Logs to this file path. Logs to a default file path if this parameter is not specified.
cron (required): A Cron expression that specifies when to run the agent. See Cron Expressions for more information.
startTime (required): The first time to run the agent.
inputParameters (optional): JSON formatted input parameters that will be provided to the agent.
Example:
{"par1":"value1","par2":"value2"}
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
UpdateAgentSchedule?agent={agentNameOrPath}&sessionId={sessionId}&scheduleId={scheduleId}&logLevel={logLevel}&logFilePath={logFilePath}&cron={cron}&startTime={startTime}&inputParameters={inputParameters}&key={key} |
Updates a schedule for a specified agent.
Content Grabber can schedule agents using its internal scheduler or the Windows Task Scheduler. This function updates a schedule in the internal scheduler.
This function supports both GET and POST requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent will run in a session with the specified session ID.
scheduleId (required): The ID of the schedule to update. The ID can be retrieved from a call to GetAgentScheduleInfoAsJson.
logLevel (required): Log detail level. Set the log level to None to turn off logging. The default log level is None. Accepted values are None, Low, Medium and High.
logFilePath (optional): Logs to this file path. Logs to a default file path if this parameter is not specified.
cron (required): A Cron expression that specifies when to run the agent. See Cron Expressions for more information.
startTime (required): The first time to run the agent.
inputParameters (optional): JSON formatted input parameters that will be provided to the agent.
Example:
{"par1":"value1","par2":"value2"}
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
UpdateOrAddAgentSchedule?agent={agentNameOrPath}&sessionId={sessionId}&logLevel={logLevel}logFilePath={logFilePath}&cron={cron}&startTime={startTime}&inputParameters={inputParameters}&key={key} |
Updates a schedule for the specified agent if there's exactly one schedule matching the agent path and session ID. Adds a schedule to the agent if there are no schedules matching the agent path and session ID. Returns an error if there's more than one schedule matching the agent path and session ID.
Content Grabber can schedule agents using its internal scheduler or the Windows Task Scheduler. This function updates or adds a schedule to the internal scheduler.
This function supports both GET and POST requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The agent will run in a session with the specified session ID.
scheduleId (required): The ID of the schedule to update The ID can be retrieved from a call to GetAgentScheduleInfoAsJson.
logLevel (required): Log detail level. Set the log level to None to turn off logging. The default log level is None. Accepted values are None, Low, Medium and High.
logFilePath (optional): Logs to this file path. Logs to a default file path if this parameter is not specified.
cron (required): A Cron expression that specifies when to run the agent. See Cron Expressions for more information.
startTime (required): The first time to run the agent.
inputParameters (optional): JSON formatted input parameters that will be provided to the agent.
Example:
{"par1":"value1","par2":"value2"}
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
DeleteAgentSchedule?key={key}&agent={agentNameOrPath}&scheduleId={scheduleId} |
Deletes a schedule for a specified agent.
Content Grabber can schedule agents using its internal scheduler or the Windows Task Scheduler. This function deletes a schedule from the internal scheduler.
This function supports both GET and POST requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
scheduleId (required): The ID of the schedule to delete. The ID can be retrieved from a call to GetAgentScheduleInfoAsJson.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
DeleteAgentSchedules?key={key}&agent={agentNameOrPath}&sessionId={sessionId} |
Deletes all schedules for a specified agent with the specified session ID.
Content Grabber can schedule agents using its internal scheduler or the Windows Task Scheduler. This function deletes a schedule from the internal scheduler.
This function supports both GET and POST requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The session ID of the schedules to delete.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
DeleteAllAgentSchedules?key={key}&agent={agentNameOrPath} |
Deletes all schedules for a specified agent.
Content Grabber can schedule agents using its internal scheduler or the Windows Task Scheduler. This function deletes a schedule from the internal scheduler.
This function supports both GET and POST requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |
RunAgentScheduleNow?key={key}&agent={agentNameOrPath}&sessionId={sessionId}&scheduleId={scheduleId} |
Runs a schedule for a specified agent with the specified session ID and schedule ID. If no schedule ID is specified, an error is returned if there is more then one schedule that matches the agent and session ID.
Content Grabber can schedule agents using its internal scheduler or the Windows Task Scheduler. This function deletes a schedule from the internal scheduler.
This function supports both GET and POST requests.
This function accepts the following parameters:
agent (required): You can specify the full path to an agent file or just the name of the agent. If you only specify the agent name, Content Grabber will look for the agent in the default location for the user running the agent service. The default agent location for the local System account is:
C:\Users\Public\Documents\Content Grabber\Agents
sessionId (optional): The session ID of the schedule to run.
scheduleId (optional): The ID of the schedule to run. The ID can be retrieved from a call to GetAgentScheduleInfoAsJson.
Key (optional): The access key used to determine which agents can be accessed if the Content Grabber API is restricted by access key. If a key is specified, the agentNameOrPath parameter should specify the agent name only without a path. |