Forms and Regions REST API

Forms and Regions REST API

Overview

The Forms and Regions REST API services allows you to get information on the Form Templates for your company.

Base URL 
https://fieldconnect.field2base.com/v2/api

Header (Required)
Authorization: Basic {CompanyID}:{Username}:{Password}:{API Sync Key}
Content-Type: application/json
Note: Authorization Header above is the same as all other Mobile Forms REST API calls. 
Note: API Developers can use OAuth 2.0 Authentication instead of the Basic Authentication. The OAuth 2.0 Authentication uses the Client Credentials Grant Type and requires the Company have a Client ID and a Client Secret generated in the Mobile Forms Portal to make web service calls to the REST API Endpoints. You can contact the Professional Services team at f2bps@field2base.com to implement OAuth 2.0 Authentication.


Supported Operations

Append to the Base URL: https://fieldconnect.field2base.com/v2/api
  1. GET forms/
    1. Retrieve a list of form templates
  2. GET forms/{folderKey}
    1. Retrieve a list of form templates in a folder
    2. folderKey is the same as projectKey or ProjKey
  3. GET forms/regions/{formTemplateID}
    1. Retrieve a list of Region details in a Form Template
  4. GET forms/regions/options/{formTemplateID}/{datasourceNameGUID}
    1. Retrieve possible datasource options
  5. GET forms/region/options/{formTemplateID}/{datasourceNameGUID}?parameters={parameterOption}
    1. Get results of executing a Datasource in a Form Template if Datasource uses parameters
Note: You will need to add "/" at the end of the call if there is a period in the Username. 


API Samples

Get All Forms

Method: GET
  1. https://fieldconnect.field2base.com/v2/api/forms/

Response:
  1. [   
  2.     {
  3.         "TemplateId": "1dd66dcf-2ab2-40b0-8241-98bfdf5a6d84",
  4.         "Name": "Inspection Sheet",
  5.         "ProjKey": "ed02146a-2ca7-4ce7-980f-7f840ba3f568",
  6.         "ProjName": "Sandbox (Ceara)",
  7.         "Version": 27,
  8.         "Description": "for home inspections"
  9.     },
  10.     {
  11.         "TemplateId": "ba056acd-75f7-45b1-b5ab-1937aab8e411",
  12.         "Name": "DVIR",
  13.         "ProjKey": "3fec86e5-7069-41e4-966e-b3ad96ed1f8e",
  14.         "ProjName": "Sandbox (Nick)",
  15.         "Version": 1,
  16.         "Description": ""
  17.     },
  18.     {
  19.         "TemplateId": "1d5f3b89-ae47-4d1d-afae-5f6d5d9d233f",
  20.         "Name": "F2B Statement of Work",
  21.         "ProjKey": "0f4300b6-9548-4e7a-85d9-c53122626010",
  22.         "ProjName": "Contracts",
  23.         "Version": 4,
  24.         "Description": ""
  25.     },
  26.     {
  27.         "TemplateId": "2d1dfad1-9ae4-4990-a3e8-ba86bdb07b1f",
  28.         "Name": "Sample Expense Report",
  29.         "ProjKey": "1be2fd67-9c0b-40ba-a440-40a9c6fe0589",
  30.         "ProjName": "Form Library",
  31.         "Version": 23,
  32.         "Description": ""
  33.     },
  34.     {
  35.         "TemplateId": "e8bac552-3486-47ff-87ed-6cfaf3c1c0fb",
  36.         "Name": "Sample Timesheet",
  37.         "ProjKey": "1be2fd67-9c0b-40ba-a440-40a9c6fe0589",
  38.         "ProjName": "Form Library",
  39.         "Version": 2,
  40.         "Description": ""
  41.     }
  42. ]

Get All Forms in a Folder

Method: GET
  1. https://fieldconnect.field2base.com/v2/api/forms/1359c762-4842-4276-be5d-90925b137a2e

Response:
  1. [
  2.     {
  3.         "TemplateId": "2d1dfad1-9ae4-4990-a3e8-ba86bdb07b1f",
  4.         "Name": "Sample Expense Report",
  5.         "ProjKey": "1359c762-4842-4276-be5d-90925b137a2e",
  6.         "ProjName": "Form Library",
  7.         "Version": 23.
  8.         "Description": "for work expenses, has a workflow for approval then send to Payroll"
  9.     },
  10.     {
  11.         "TemplateId": "e8bac552-3486-47ff-87ed-6cfaf3c1c0fb",
  12.         "Name": "Sample Timesheet",
  13.         "ProjKey": "1359c762-4842-4276-be5d-90925b137a2e",
  14.         "ProjName": "Form Library",
  15.         "Version": 2,
  16.         "Description": ""
  17.     }
  18. ]

Get Region Details for a Form

Method: GET
  1. https://fieldconnect.field2base.com/v2/api/forms/regions/2d1dfad1-9ae4-4990-a3e8-ba86bdb07b1f

Response:
  1. [
  2.     {
  3.         "Number": 1,
  4.         "Name": "PageName1",
  5.         "Description": "",
  6.         "Title": "Page 1 Regions",
  7.         "Regions": [
  8.             {
  9.                 "FullName": "Page1@ApprovalSignDate",
  10.                 "DisplayName": "ApprovalSignDate",
  11.                 "Type": "Label",
  12.                 "DefaultValue": "",
  13.                 "DateTimeFormat": null,
  14.                 "Options": null,
  15.                 "MaxTextLength": null,
  16.                 "MinDateValue": null,
  17.                 "MaxDateValue": null,
  18.                 "IsRequired": false,
  19.                 "DecimalPlaces": null,
  20.                 "MaxNumericValue": null,
  21.                 "MinNumericValue": null,
  22.                 "Formula": "",
  23.                 "UserCanOverride": false,
  24.                 "UserCanEdit": true,
  25.                 "ToolTip": "",
  26.                 "DataSourceName": "",
  27.                 "DataSourceParameters": []
  28.             },
  29.             {
  30.                 "FullName": "Page1@EmployeeName",
  31.                 "DisplayName": "EmployeeName",
  32.                 "Type": "Text",
  33.                 "DefaultValue": "",
  34.                 "DateTimeFormat": null,
  35.                 "Options": null,
  36.                 "MaxTextLength": null,
  37.                 "MinDateValue": null,
  38.                 "MaxDateValue": null,
  39.                 "IsRequired": true,
  40.                 "DecimalPlaces": null,
  41.                 "MaxNumericValue": null,
  42.                 "MinNumericValue": null,
  43.                 "Formula": "",
  44.                 "UserCanOverride": false,
  45.                 "UserCanEdit": true,
  46.                 "ToolTip": "",
  47.                 "DataSourceName": "",
  48.                 "DataSourceParameters": []
  49.             },
  50.             {
  51.                 "FullName": "Page1@EndDate",
  52.                 "DisplayName": "EndDate",
  53.                 "Type": "Date",
  54.                 "DefaultValue": "",
  55.                 "DateTimeFormat": "M/d/yyyy",
  56.                 "Options": null,
  57.                 "MaxTextLength": null,
  58.                 "MinDateValue": "0002-01-01T00:00:00",
  59.                 "MaxDateValue": "9998-12-31T23:59:59.999",
  60.                 "IsRequired": true,
  61.                 "DecimalPlaces": null,
  62.                 "MaxNumericValue": null,
  63.                 "MinNumericValue": null,
  64.                 "Formula": "",
  65.                 "UserCanOverride": false,
  66.                 "UserCanEdit": true,
  67.                 "ToolTip": "",
  68.                 "DataSourceName": "",
  69.                 "DataSourceParameters": []
  70.             }
  71.         ]
  72.     },
  73.     {
  74.         "Number": 2,
  75.         "Name": "Page2",
  76.         "Description": "",
  77.         "Title": "Page 2 Regions",
  78.         "Regions": [
  79.             {
  80.                 "FullName": "Page2@ExpenseCategory1",
  81.                 "DisplayName": "ExpenseCategory1",
  82.                 "Type": "Datasource",
  83.                 "DefaultValue": "",
  84.                 "DateTimeFormat": null,
  85.                 "Options": [
  86.                     "Airfare",
  87.                     "Hotel",
  88.                     "Meals",
  89.                     "Rental Car",
  90.                     "Transit / Ride Share",
  91.                     "Personal Vehicle",
  92.                     "Phone Bill"
  93.                 ],
  94.                 "MaxTextLength": null,
  95.                 "MinDateValue": null,
  96.                 "MaxDateValue": null,
  97.                 "IsRequired": false,
  98.                 "DecimalPlaces": null,
  99.                 "MaxNumericValue": null,
  100.                 "MinNumericValue": null,
  101.                 "Formula": "",
  102.                 "UserCanOverride": false,
  103.                 "UserCanEdit": true,
  104.                 "ToolTip": "",
  105.                 "DataSourceName": "7e9a57a3-dba3-41e0-aa43-ea38e3bc8827",
  106.                 "DataSourceParameters": []
  107.             },
  108.             {
  109.                 "FullName": "Page2@ExpenseComments1",
  110.                 "DisplayName": "ExpenseComments1",
  111.                 "Type": "Text",
  112.                 "DefaultValue": "",
  113.                 "DateTimeFormat": null,
  114.                 "Options": null,
  115.                 "MaxTextLength": null,
  116.                 "MinDateValue": null,
  117.                 "MaxDateValue": null,
  118.                 "IsRequired": false,
  119.                 "DecimalPlaces": null,
  120.                 "MaxNumericValue": null,
  121.                 "MinNumericValue": null,
  122.                 "Formula": "",
  123.                 "UserCanOverride": false,
  124.                 "UserCanEdit": true,
  125.                 "ToolTip": "",
  126.                 "DataSourceName": "",
  127.                 "DataSourceParameters": []
  128.             },
  129.             {
  130.                 "FullName": "Page2@ExpenseDate1",
  131.                 "DisplayName": "ExpenseDate1",
  132.                 "Type": "Date",
  133.                 "DefaultValue": "",
  134.                 "DateTimeFormat": "M/d/yyyy",
  135.                 "Options": null,
  136.                 "MaxTextLength": null,
  137.                 "MinDateValue": "0002-01-01T00:00:00",
  138.                 "MaxDateValue": "9998-12-31T23:59:59.999",
  139.                 "IsRequired": false,
  140.                 "DecimalPlaces": null,
  141.                 "MaxNumericValue": null,
  142.                 "MinNumericValue": null,
  143.                 "Formula": "",
  144.                 "UserCanOverride": false,
  145.                 "UserCanEdit": true,
  146.                 "ToolTip": "",
  147.                 "DataSourceName": "",
  148.                 "DataSourceParameters": []
  149.             },
  150.             {
  151.                 "FullName": "Page2@ExpensePhoto1",
  152.                 "DisplayName": "ExpensePhoto1",
  153.                 "Type": "Camera",
  154.                 "DefaultValue": "",
  155.                 "DateTimeFormat": null,
  156.                 "Options": null,
  157.                 "MaxTextLength": null,
  158.                 "MinDateValue": null,
  159.                 "MaxDateValue": null,
  160.                 "IsRequired": false,
  161.                 "DecimalPlaces": null,
  162.                 "MaxNumericValue": null,
  163.                 "MinNumericValue": null,
  164.                 "Formula": "",
  165.                 "UserCanOverride": false,
  166.                 "UserCanEdit": true,
  167.                 "ToolTip": "",
  168.                 "DataSourceName": "",
  169.                 "DataSourceParameters": []
  170.             },
  171.             {
  172.                 "FullName": "Page2@ExpenseTotal1",
  173.                 "DisplayName": "ExpenseTotal1",
  174.                 "Type": "Numeric",
  175.                 "DefaultValue": "",
  176.                 "DateTimeFormat": null,
  177.                 "Options": null,
  178.                 "MaxTextLength": null,
  179.                 "MinDateValue": null,
  180.                 "MaxDateValue": null,
  181.                 "IsRequired": false,
  182.                 "DecimalPlaces": 2,
  183.                 "MaxNumericValue": null,
  184.                 "MinNumericValue": null,
  185.                 "Formula": "",
  186.                 "UserCanOverride": false,
  187.                 "UserCanEdit": true,
  188.                 "ToolTip": "",
  189.                 "DataSourceName": "",
  190.                 "DataSourceParameters": []
  191.             },
  192.             {
  193.                 "FullName": "Page2@MilesDriven1",
  194.                 "DisplayName": "MilesDriven1",
  195.                 "Type": "Numeric",
  196.                 "DefaultValue": "",
  197.                 "DateTimeFormat": null,
  198.                 "Options": null,
  199.                 "MaxTextLength": null,
  200.                 "MinDateValue": null,
  201.                 "MaxDateValue": null,
  202.                 "IsRequired": false,
  203.                 "DecimalPlaces": null,
  204.                 "MaxNumericValue": null,
  205.                 "MinNumericValue": null,
  206.                 "Formula": "",
  207.                 "UserCanOverride": false,
  208.                 "UserCanEdit": true,
  209.                 "ToolTip": "Mileage rate is automatically calculated at .58 per mile",
  210.                 "DataSourceName": "",
  211.                 "DataSourceParameters": []
  212.             },
  213.             {
  214.                 "FullName": "Page2@NoReceipt1",
  215.                 "DisplayName": "NoReceipt1",
  216.                 "Type": "Checkbox",
  217.                 "DefaultValue": "",
  218.                 "DateTimeFormat": null,
  219.                 "Options": null,
  220.                 "MaxTextLength": null,
  221.                 "MinDateValue": null,
  222.                 "MaxDateValue": null,
  223.                 "IsRequired": false,
  224.                 "DecimalPlaces": null,
  225.                 "MaxNumericValue": null,
  226.                 "MinNumericValue": null,
  227.                 "Formula": "",
  228.                 "UserCanOverride": false,
  229.                 "UserCanEdit": true,
  230.                 "ToolTip": "",
  231.                 "DataSourceName": "",
  232.                 "DataSourceParameters": []
  233.             }
  234.         ]
  235.     }
  236. ]

Get Options for a Datasource Region

Method: GET
  1. https://fieldconnect.field2base.com/v2/api/forms/region/options/2d1dfad1-9ae4-4990-a3e8-ba86bdb07b1f/7e9a57a3-dba3-41e0-aa43-ea38e3bc8827

Response:
  1. [
  2.     "Airfare",
  3.     "Hotel",
  4.     "Meals",
  5.     "Rental Car",
  6.     "Transit / Ride Share",
  7.     "Personal Vehicle",
  8.     "Phone Bill"
  9. ]

Get Options for a Datasource Region with Parameters

Method: GET

This example assumes that we are using two regions, with Region 1 as a parameter for the Region 2 query. For this example, we will assume that the corresponding datafile contains an ExpenseCategory "Airfare" with a corresponding Rate of "$100".

Region 1: {
                      FullName: "Page2@ExpenseCategory1",              
                      Type: "Datasource",
                      DataSourceName: "7e9a57a3-dba3-41e0-aa43-ea38e3bc8827"
                 }

Region 2: {
                      FullName: "Page2@Rate1",              
                      Type: "Datasource",
                      DataSourceName: "1a2b3c4d-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                      DataSourceParameters: [
                              "{Page2@ExpenseCategory1}"
                      ]
                 }

Region 2 SQL Query: 
                  SELECT [Rate]
                  FROM [SheetName$]
                  WHERE [ExpenseCategory] = ?

                  Parameters: {Page2@ExpenseCategory1}

  1. https://fieldconnect.field2base.com/v2/api/forms/region/options/2d1dfad1-9ae4-4990-a3e8-ba86bdb07b1f/1a2b3c4d-xxxx-xxxx-xxxx-xxxxxxxxxxxx?parameters=Airfare
Response:
  1. {
  2.       "$100"
  3. }

Note: If you are using multiple parameters in a query, use the endpoint format: forms/region/options/{formTemplateID}/{DataSourceName}?parameters={parameter option}&parameters={parameter option}