Click or drag to resize
Running a template
Print this page

To run a template, POST to the following address:

https://acme.api.telogis.com/execute?
template=<template id or name>
&<user input1>=<value 1>
&...<user input n>=<value n>

The template runs in synchronous mode by default. For templates that require longer processing time, you can run in asynchronous mode by setting the PollingMode query parameter when you submit the request.

This topic contains the following sections:

Passing parameters

The query parameters of the URL provide the values for any variables declared in the User section of the template. When passing parameters, follow these rules:

  • No spaces between the variable name, equals sign, and value.

  • No quotes around the value portion of a parameter.

  • Ampersand (&) separators between parameter variable/value pairs.

    ...&ReportStart=2012-10-10&ReportEnd=2012-10-12

HTTP Request body

If the template is a create or update template, the body of the request will contain the input data.

Response messages for synchronous mode

The possible response status codes when running a template in synchronous mode are:

  • 200 - OK: Indicates that the request was completed successfully.
  • 303 - See Other: The response to the request can be found under a different URI and should be retrieved using a GET method on that resource. This status code is only sent for requests made in synchronous mode. Most clients follow 303 redirects automatically, but some must be enabled explicitly. If you need further information, see the 303 HTTP specification.
  • For more information, or if you encounter an error, see Status codes and responses.

For synchronous mode (default), the response body varies according to the type of template.

For Retrieve templates, the response (on success) will be the data corresponding to the output section of the template. For example:

CSV
label,Number,Street,CityName,State,Zip,Lat,Lon
Marker 1,654,S Raymond Rd,La Grange,Texas,78945,30,-97
Marker 2,0,,,,,30,173.000021457673
Marker 4,1,,Killeen,Texas,76542,31,-97.7000002682209

For Create, Update, and Delete templates, the response (on success) indicates the number of failed, created, updated, and deleted changes, and it indicates the Commit mode of the template. For example:

JSON
{  
   "Commit":true,
   "Failed": 0,
   "Created": 3,
   "Deleted": 0,
   "Updated": 0
}

While you may have received a 200 indicating that the template completed successfully, it is possible for individual entries to fail. If that occurs, then the JSON response body includes information about the failed records.

For example:

JSON
{
  "Parse Failed Records": [
    {
      "Reason": "Cannot parse color Blue as it is not formatted as a hexadecimal RGB color",
      "InputRow": 2,
      "Row": "Category 1,Blue",
      "errorInfo": [
        {
          "errorText": "Cannot parse color Blue as it is not formatted as a hexadecimal RGB color",
          "errorCode": "3.1.10"
        }
      ]
    }
  ],
  "Commit": true,
  "Failed": 1,
  "Created": 0,
  "Deleted": 0,
  "Updated": 2
}
Tip Tip

See Status codes and responses for more information about the JSON response body.

Response messages for asynchronous mode

The query string parameter PollingMode lets you run queries in the background (asynchronously) when you have long-running input and retrieve templates. PollingMode can be set to the following values:

Async

Sets template processing to asynchronous mode. When you submit a request, the JSON response provides a URL to check for status updates.

Redirect202

Sets template processing to asynchronous mode and adds additional time to the polling interval. When you submit a request, the sytem returns the redirect count along with the URL to check for status updates.

Use this option if your client framework will timeout after a set number of redirects.

Redirect303

This setting disables asynchronous polling and runs the request in the default synchronous mode.

The possible response status codes when running a template in asynchronous mode are:

  • 202 - Accepted: The request has been accepted for processing, but the processing has not been completed. This status code is only sent for requests made in asynchronous mode.
  • For more information, or if you encounter an error, see Status codes and responses.

When you receive a 202 response, the return value gives the web page for requesting status updates. For example, if the request includes the query string &PollingMode=Async you get a response like the following:

{"ResultUrl":"https://acme.api.telogis.com/runner/MTM5ZWE3MTYtNjM5ZS00ZGY4LTk1MjgtODE0MTE5NzU4OGJmfGxhLWludGVncmF0ZTMudGVsb2dpcy5sb2NhbDo4MQ=="}

After the request is submitted, the following responses are returned during processing:

{ "Status": "Preparing" }
{ "Status": "Retrieving" }

When the request completes, TDE returns the results.

If the request includes the query string &PollingMode=Redirect202, the response also includes the redirect count:

{
 "RedirectCount": 1
 "ResultUrl":"https://acme.api.telogis.com/runner/MTM5ZWE3MTYtNjM5ZS00ZGY4LTk1MjgtODE0MTE5NzU4OGJmfGxhLWludGVncmF0ZTMudGVsb2dpcy5sb2NhbDo4MQ=="
}

To get a status update or the result string, make a GET request to the URL provided. Possible response status codes when requesting to this URL are:

  • 200 - OK: Indicates that the request was completed successfully.
  • 202 - Accepted: The request has been accepted for processing, but the processing has not been completed.
  • For more information, or if you encounter an error, see Status codes and responses.