FRAMES | NO FRAMES | |
Gets the list of all available report templates for summary reports.
ReportTemplateInfo[] GetReportTemplates ( String ActiveDatasetID, String token );
Parameter | Description |
---|---|
ActiveDatasetID | Specify a dataset to perform Online API tasks or operations. |
token | User authentication token received from Authentication Web Service. Type String. |
Variable of type ReportTemplateInfo[].
The Get Report Templates service returns a list of available report templates including their respective titles, categories, available formats, customizable header fields, and names. The result of this service is an array of ReportTemplateInfo objects which provides information about Summary Report templates and the names to use when specifying them in subsequent analysis. Report template names are used in the ReportOptions parameter in Drive Time, Simple Rings, and Summary Reports.
The Get Report Templates service returns a list of available Summary Reports templates and their available output formats in HTML, JSON, PJSON, and XML formats.
Some applications of Get Report Templates include the following:
Example (1) Code
C# |
// Authentication: Uses BAOReportHelper class for token management. // Instantiate BAOReportHelper class string tokenServiceUrl = "https://baoapi.esri.com/bawebservices/rest/authentication"; // Business Analyst Online API Sample credentials. // NOTE: These credentials are associated with an // account which constrains analysis to the // two ZIP codes in Redlands, CA. string username = "BAOAPISAMPLE"; // Substitute user name here string password = "baoapisample"; // Substitute password here ITokenProvider tokenProvider = new HTTPTokenProvider(tokenServiceUrl, username, password); BAOReportHelper baoReportHelper = new BAOReportHelper(tokenProvider); // Execute the task // When the ActiveDatasetID paramter value is null, the default // dataset is specified. See GetDatasets to obtain a list of // available datasets. ReportTemplateInfo[] templates = baoReportHelper.GetReportTemplates(null); // Iterate through report templates and create their description in the // templateDescriptions array string[] templateDescriptions = new string[templates.Length]; for (int i = 0; i < templates.Length; i++) { ReportTemplateInfo template = templates[i]; templateDescriptions[i] = string.Format("NAME: {0} TITLE: {1} CATEGORY: {2} FORMATS: {3} CUSTOMIZABLE HEADER FIELDS: {4}", template.Name, template.Title, template.Category, string.Join(";", template.Formats), string.Join(";", template.Headers)); } |
Example (1) Code
VB.NET |
' Authentication: Uses BAOReportHelper class for token management. ' Instantiate BAOReportHelper class Dim tokenServiceUrl As String = "https://baoapi.esri.com/bawebservices/rest/authentication" ' Business Analyst Online API Sample credentials. ' NOTE: These credentials are associated with an ' account which constrains analysis to the ' two ZIP codes in Redlands, CA. Dim username As String = "BAOAPISAMPLE" ' Substitute user name here Dim password As String = "baoapisample" ' Substitute password here Dim tokenProvider As ITokenProvider = New HTTPTokenProvider(tokenServiceUrl, username, password) Dim baoReportHelper As New BAOReportHelper(tokenProvider) ' Execute the task Dim templates As ReportTemplateInfo() = baoReportHelper.GetReportTemplates(Nothing) ' Iterate through report templates and create their description in the ' templateDescriptions array Dim templateDescriptions As String() = New String(templates.Length - 1) {} For i As Integer = 0 To templates.Length - 1 Dim template As ReportTemplateInfo = templates(i) templateDescriptions(i) = String.Format("NAME:{0} TITLE:{1} CATEGORY:{2} HEADERS:{3} FORMATS:{4}", _ template.Name, template.Title, template.Category, String.Join(";", template.Headers), String.Join(";", template.Formats)) Next |
Example 2: Retrieve a list of Business Analyst reports which can be generated with a specific Business Analyst Online API subscription account.
Notes: Example 2 demonstrates code which consumes the BAOReport proxy class (generated from the WSDL ) without leveraging the BAOReportHelper class. Please view Example 1 above for additional information about the BAOReportHelper class.
Example (2) Code
C# |
// Authentication: Uses Authentication proxy class to generate token. // Business Analyst Online API Sample credentials. // NOTE: These credentials are associated with an // account which constrains analysis to the // two ZIP codes in Redlands, CA. string username = "BAOAPISAMPLE"; // Substitute user name here string password = "baoapisample"; // Substitute password here Authentication auth = new Authentication(); string token = auth.getToken(username, password); // Instantiate the BAOReport proxy object to submit the // request BAOReport baoReportProxy = new BAOReport(); // Execute the task // When the ActiveDatasetID paramter value is null, the default // dataset is specified. See GetDatasets to obtain a list of // available datasets. ReportTemplateInfo[] templates = baoReportProxy.GetReportTemplates(null, token); // Iterate through report templates and create their description in the // templateDescriptions array string[] templateDescriptions = new string[templates.Length]; for (int i = 0; i < templates.Length; i++) { ReportTemplateInfo template = templates[i]; templateDescriptions[i] = string.Format("NAME: {0} TITLE: {1} CATEGORY: {2} FORMATS: {3} CUSTOMIZABLE HEADER FIELDS: {4}", template.Name, template.Title, template.Category, string.Join(";", template.Formats), string.Join(";", template.Headers)); } |
Example (2) Code
VB.NET |
' Authentication: Uses Authentication proxy class to generate token. ' Business Analyst Online API Sample credentials. ' NOTE: These credentials are associated with an ' account which constrains analysis to the ' two ZIP codes in Redlands, CA. Dim username As String = "BAOAPISAMPLE" ' Substitute user name here Dim password As String = "baoapisample" ' Substitute password here Dim auth As New Authentication() Dim token As String = auth.getToken(username, password) ' Instantiate the BAOReport proxy object to submit the ' request Dim baoReportProxy As New BAOReport() ' Execute the task Dim templates As ReportTemplateInfo() = baoReportProxy.GetReportTemplates(Nothing, token) ' Iterate through report templates and create their description in the ' templateDescriptions array Dim templateDescriptions As String() = New String(templates.Length - 1) {} For i As Integer = 0 To templates.Length - 1 Dim template As ReportTemplateInfo = templates(i) templateDescriptions(i) = String.Format("NAME:{0} TITLE:{1} CATEGORY:{2} HEADERS:{3} FORMATS:{4}", _ template.Name, template.Title, template.Category, String.Join(";", template.Headers), String.Join(";", template.Formats)) Next |