Custom Fields REST API

Custom Fields

Returns a list of all custom fields defined in Crittah. This web service is used to identify all custom fields configured in Crittah. The information provided by the custom fields can be used to add custom field data to jobs when adding or updating them. 

Data fields

FieldValue typeDescriptionExample
IDCustomFieldstringUnique identifier of the custom field7090fad1-c4da-4488-9ceb-55ee9847edcc
NamestringName of the custom fieldBoxes
Typestring

The custom field type

  • Measurement
  • Date
  • Selector
  • Yes-No
  • Number

Measurement

DescrstringDescription of custom fieldNumber of boxes
DefaultValuestringDefault valueFred
DecimalPlacesintDecimal places if type is numbe2
ManditorybooleanIs the field mandatorytrue
MinimumLengthintwhat is the lengh of the field3
AbbreviationstringField abbreviation used in reports and small displaysBXS

Get custom fields

get all custom fields.

Sample cURL call:

curl -H "Content-Type: application/json"  \
-H "API-AppID: 7090fad1-c4da-4488-9ceb-55ee9847edcc" \
-H "Api-Username: jsmith" \
-H "API-Password: abc123" \
http://[CompanyID].crittah.com/ws/apiv2/json/customfields

JSON Rsponse:

[
   {
    "IDCustomField": "d1caa07e-6867-4f1d-b54b-32c80e63a1b1",
    "Name": "Box Weight",
    "Type": "Measurement",
    "Descr": "Weight of boxes.",
    "DefaultValue": "0",
    "DecimalPLaces": 0,
    "Manditory": true,
    "MinimumLength": 0,
    "Abbreviation": "BXS"
  },
  {
    "IDCustomField": "63d53c06-964a-4b76-bc5f-e9ccad651dc3",
    "Name": "Containers Required",
    "Type": "Yes-No",
    "Descr": "Containers Required",
    "DefaultValue": "0",
    "DecimalPLaces": 0,
    "Manditory": true,
    "MinimumLength": 0,
    "Abbreviation": "CNT"
  }
]

XML Response: 

<?xml version="1.0" encoding="UTF-8"?>
<ArrayOfCustomFieldDefObj xmlns="http://schemas.datacontract.org/2004/07/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<CustomFieldDefObj>
      <IDCustomField>d1caa07e-6867-4f1d-b54b-32c80e63a1b1</IDCustomField>
      <Name>Box Weight</Name>
      <Type>Measurement</Type>
      <Descr>Weight of boxes.</Descr>
      <DefaultValue>0</DefaultValue>
      <DecimalPLaces>0</DecimalPLaces>
      <Manditory>true</Manditory>
      <MinimumLength>0</MinimumLength>
      <Abbreviation>BXS</Abbreviation>
   </CustomFieldDefObj>
   <CustomFieldDefObj>
      <IDCustomField>63d53c06-964a-4b76-bc5f-e9ccad651dc3</IDCustomField>
      <Name>Containers Required</Name>
      <Type>Yes-No</Type>
      <Descr>Containers Required</Descr>
      <DefaultValue>0</DefaultValue>
      <DecimalPLaces>0</DecimalPLaces>
      <Manditory>true</Manditory>
      <MinimumLength>0</MinimumLength>
      <Abbreviation>CNT</Abbreviation>
   </CustomFieldDefObj>
</ArrayOfCustomFieldDefObj>

 

Custom fields for job type

Returns a list of all custom fields configured for a job type. This service provides additional configuration information pertaining to the custom field for this job

Data fields

FieldValue typeDescriptionExample
IDCustomFieldstringUnique identifier of the custom field7090fad1-c4da-4488-9ceb-55ee9847edcc
OrderintThe order to display the custom field in2
NamestringName of the custom fieldBoxes
Typestring

The custom field type

  • Measurement
  • Date
  • Selector
  • Yes-No
  • Number

Measurement

DescrstringDescription of custom fieldNumber of boxes
DefaultValuestringDefault valueFred
AddsToVehiclebooleanIf the custom field is a number or a measure, this value defines if the measure or number is being added to the vehicletrue
DecimalPlacesintDecimal places if type is numbe2
ManditorybooleanIs the field mandatorytrue
MinimumLengthintwhat is the lengh of the field3
AbbreviationstringField abbreviation used in reports and small displaysBXS
CalcOrderintThe order in which calculated fields should be calculated. This is required so that calculated fields that may be dependent on other calculated fields are calculated in the correct order.2
CalcFormulastringThe formula used to calculate fields value. Calculated fields can calculate its value based on an expression that can incorporate other custom field values as well as some job values. When custom fields are used in the expression the custom fields ID is used between square brackets (e.g. [734527F9-7771-40CC-803A-05B97F0ADCEA])[734527F9-7771-40CC-803A-05B97F0ADCEA] * [D41853CB-D2FE-4EE7-A1AA-187B9E1AF84D]
DeviceCanEditbooleanIndicates if the device can edit the field information. This is used when drivers should be restricted from editing the field.true

Get custom fields

get all custom fields.

Sample cURL call:

curl -H "Content-Type: application/json"  \
-H "API-AppID: 7090fad1-c4da-4488-9ceb-55ee9847edcc" \
-H "Api-Username: jsmith" \
-H "API-Password: abc123" \
http://[CompanyID].crittah.com/ws/apiv2/json/customfields/jobtype/BD176BE9-8C1B-4CD3-9B54-5AD51B2DE3F4

JSON Rsponse:

[
   {
    "IDCustomField": "d1caa07e-6867-4f1d-b54b-32c80e63a1b1",
    "Order": 1,
    "Name": "Box Weight",
    "Type": "Measurement",
    "Descr": "Weight of boxes.",
    "DefaultValue": "0",
    "AddsToVehicle": true,
    "DecimalPLaces": 0,
    "Manditory": true,
    "MinimumLength": 0,
    "Abbreviation": "BXS",
    "CalcOrder": 0,
    "CalcFormula": "",
    "DeviceCanEdit": true
  },
  {
    "Order": 3,
    "IDCustomField": "734527f9-7771-40cc-803a-05b97f0adcea",
    "Name": "Job Distance",
    "Type": "CalcNumber",
    "Descr": "Distance between two cust fields with odometer reading",
    "DefaultValue": "0",
    "DecimalPLaces": 2,
    "AddsToVehicle": false,
    "Manditory": true,
    "MinimumLength": 0,
    "Abbreviation": "DST",
    "CalcOrder": 1,
    "CalcFormula": " [DEA8A5BC-BF8E-4A81-A81A-0E5FE8D76E90] -[A9502474-D9C3-476C-AE04-723E17F134A0]",
    "DeviceCanEdit": true
  },
  {
    "IDCustomField": "63d53c06-964a-4b76-bc5f-e9ccad651dc3",
    "Order": 2,
    "Name": "Containers Required",
    "Type": "Yes-No",
    "Descr": "Containers Required",
    "DefaultValue": "0",
    "AddsToVehicle": true,
    "DecimalPLaces": 0,
    "Manditory": true,
    "MinimumLength": 0,
    "Abbreviation": "CNT",
    "CalcFormula": "",
    "DeviceCanEdit": true
  }
]

XML Response: 

<?xml version="1.0" encoding="UTF-8"?>
<ArrayOfCustomFieldDefMap xmlns="http://schemas.datacontract.org/2004/07/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<CustomFieldDefMap>
      <IDCustomField>d1caa07e-6867-4f1d-b54b-32c80e63a1b1</IDCustomField>
      <Order>1</Order>
      <Name>Box Weight</Name>
      <Type>Measurement</Type>
      <Descr>Weight of boxes.</Descr>
      <DefaultValue>0</DefaultValue>
      <AddsToVehicle>true</AddsToVehicle>
      <DecimalPLaces>0</DecimalPLaces>
      <Manditory>true</Manditory>
      <MinimumLength>0</MinimumLength>
      <Abbreviation>BXS</Abbreviation>
      <CalcOrder>0</CalcOrder>
      <CalcFormula></CalcFormula>
      <DeviceCanEdit>true</DeviceCanEdit>
   </CustomFieldDefMap>
   <CustomFieldDefMap>
      <IDCustomField>63d53c06-964a-4b76-bc5f-e9ccad651dc3</IDCustomField>
      <Order>1</Order>
      <Name>Containers Required</Name>
      <Type>Yes-No</Type>
      <Descr>Containers Required</Descr>
      <DefaultValue>0</DefaultValue>
      <AddsToVehicle>true</AddsToVehicle>
      <DecimalPLaces>0</DecimalPLaces>
      <Manditory>true</Manditory>
      <MinimumLength>0</MinimumLength>
      <Abbreviation>CNT</Abbreviation>
      <CalcOrder>0</CalcOrder>
      <CalcFormula></CalcFormula>
      <DeviceCanEdit>true</DeviceCanEdit>
   </CustomFieldDefMap>
   <CustomFieldDefMap>
      <Order>3</Order>
      <IDCustomField>734527f9-7771-40cc-803a-05b97f0adcea</IDCustomField>
      <Name>Job Distance</Name>
      <Type>CalcNumber</Type>
      <Descr>Distance between two cust fields with odometer reading</Descr>
      <DefaultValue>0</DefaultValue>
      <DecimalPLaces>2</DecimalPLaces>
      <AddsToVehicle>false</AddsToVehicle>
      <Manditory>true</Manditory>
      <MinimumLength>0</MinimumLength>
      <Abbreviation>DST</Abbreviation>
      <CalcOrder>1</CalcOrder>
      <CalcFormula>[DEA8A5BC-BF8E-4A81-A81A-0E5FE8D76E90] -[A9502474-D9C3-476C-AE04-723E17F134A0]</CalcFormula>
      <DeviceCanEdit>true</DeviceCanEdit>
   </CustomFieldDefMap>
</ArrayOfCustomFieldDefMap>