Service Form API

Form Field Types

Id Name
1 Text
2 Number
3 Date
4 Time
5 List
6 MultiList
7 Attachment
8 Signature

Additionally, these values can be obtained from /Settings response.

 

  Create Service Form
URL /ServiceForm
Method POST
Body

{
"Name": "test service form", //Mandatory field
"Description": "Form Description",
"IsDefault": false,

"FormFields":[]
}

Response
{
"Data": null,
"Id": 2,
"IsSuccess": true,
"Message": "Added"
}
Comments

This request allows user to create a new Service Form. The response has standard format, it contains Id and IsSuccess fields. Id should be persisted somewhere for future usage.

  Get Service Forms
URL /ServiceForms
Method GET
Body

 

Response

[
{
"Description": "This is an example \"Service Form\" included to help illustrate how this website functions. Feel free to retain it for your records or delete if it is no longer useful.",
"FormFields": [
{
"DefaultFile": null,
"DefaultListItems": null,
"DefaultValue": "",
"Id": 1,
"ListItems": null,
"Name": "Inspection Date",
"Position": 1,
"Required": true,
"ServiceFormFieldType": "Date",
"ServiceFormFieldTypeId": 3,
"ServiceFormId": 1
},
{
"DefaultFile": null,
"DefaultListItems": null,
"DefaultValue": "",
"Id": 2,
"ListItems": null,
"Name": "Inspection Time",
"Position": 2,
"Required": false,
"ServiceFormFieldType": "Time",
"ServiceFormFieldTypeId": 4,
"ServiceFormId": 1
},
{
"DefaultFile": null,
"DefaultListItems": null,
"DefaultValue": "Default Location",
"Id": 3,
"ListItems": null,
"Name": "Location",
"Position": 3,
"Required": false,
"ServiceFormFieldType": "Text",
"ServiceFormFieldTypeId": 1,
"ServiceFormId": 1
},
{
"DefaultFile": null,
"DefaultListItems": null,
"DefaultValue": null,
"Id": 5,
"ListItems": null,
"Name": "Manufacturer",
"Position": 4,
"Required": false,
"ServiceFormFieldType": "Text",
"ServiceFormFieldTypeId": 1,
"ServiceFormId": 1
},
{
"DefaultFile": null,
"DefaultListItems": null,
"DefaultValue": null,
"Id": 6,
"ListItems": null,
"Name": "Model",
"Position": 5,
"Required": false,
"ServiceFormFieldType": "Text",
"ServiceFormFieldTypeId": 1,
"ServiceFormId": 1
},
{
"DefaultFile": null,
"DefaultListItems": null,
"DefaultValue": null,
"Id": 4,
"ListItems": [
"Please Specify",
"Yes",
"No",
"Unknown"
],
"Name": "Operational",
"Position": 6,
"Required": false,
"ServiceFormFieldType": "List",
"ServiceFormFieldTypeId": 5,
"ServiceFormId": 1
},
{
"DefaultFile": null,
"DefaultListItems": [
"Item 2",
"Item 3"
],
"DefaultValue": null,
"Id": 9,
"ListItems": [
"Item 1",
"Item 2",
"Item 3"
],
"Name": "MultiList",
"Position": 7,
"Required": false,
"ServiceFormFieldType": "MultiList",
"ServiceFormFieldTypeId": 6,
"ServiceFormId": 1
},
{
"DefaultFile": {
"ContentType": "image\/png",
"FileName": "Olympic-logo.png",
"FileNameInternal": "8c591856-b88a-4f07-bb2c-c0d81e70a593"
},
"DefaultListItems": null,
"DefaultValue": null,
"Id": 10,
"ListItems": null,
"Name": "Attachment",
"Position": 8,
"Required": false,
"ServiceFormFieldType": "Attachment",
"ServiceFormFieldTypeId": 7,
"ServiceFormId": 1
},
{
"DefaultFile": null,
"DefaultListItems": null,
"DefaultValue": null,
"Id": 11,
"ListItems": null,
"Name": "Signature",
"Position": 9,
"Required": false,
"ServiceFormFieldType": "Signature",
"ServiceFormFieldTypeId": 8,
"ServiceFormId": 1
}
],
"Id": 1,
"IsDefault": true,
"Name": "Inspection (Example Form)"
}
]

Comments

 This request allows user to get all Service Forms and their fields. If field's type is List or Multi-List then ListItems property in response is not empty - it is an array of strings (like field "MultiList" in the example below). If default value is set for a field then:
1) if field's type is either Text, or Number, or Date, or Time then default value is returned in "DefaultValue" field
2) if field's type is either List or Multi-List then default value is returned in "DefaultListItems" field  - it is an array of strings (like field "MultiList" in the example below)
3) if field's type is either Attachment or Signature then default value is returned in "DefaultFile" field. Example can be found below for the field called "Attachment"

  Create Service Form Fields
URL /ServiceFormField
Method POST
Body

If field's type is either Text, or Number, or Date, or Time (ServiceFormFieldTypeId property should be changed correspondingly)
{
"Name": "FieldName 1", //Mandatory field
"Required": true,
"ServiceFormId": 6, //Mandatory field
"ServiceFormFieldTypeId": 1, //Mandatory field
"DefaultValue": null

If field's type is either List or Multi-List (ServiceFormFieldTypeId property should be changed correspondingly)
{
"Name": "FieldName 2", //Mandatory field
"Required": true,
"ServiceFormId": 6, //Mandatory field
"ServiceFormFieldTypeId": 5, //Mandatory field
"ListItems": //Mandatory field
[
"Item 1", "Item 2", "Item 3"
],
"DefaultListItems":null
}

If field's type is either Attachment or Signature (ServiceFormFieldTypeId property should be changed correspondingly)
{
"Name": "FieldName 3", //Mandatory field
"Required": true,
"ServiceFormId": 6, //Mandatory field
"ServiceFormFieldTypeId": 7, //Mandatory field
"DefaultFile" : {
"ContentType": "image\/png",
"FileName": "Olympic-logo-1.png"
}
}

Response

{
"Data": null,
"Id": 8,
"IsSuccess": true,
"Message": "Create"
}

NOTE. If user sends DefaultFile property then the response will contain Data field with random GUID. This GUID should be persisted for future usages (e.g. file upload/download)

Comments

This request allows user to create a new Service Form Field for specific Service Form. The response has standard format, it contains Id and IsSuccess fields. Id should be persisted somewhere for future usage.

  Attach Service Form to Customer
URL /ServiceForm/Customer 
Method POST
Body

{
"CustomerId":1,
"ServiceFormId":6,

"CustomName":"Form1"
}

Response

{
"Data": null,
"Id": 3,
"IsSuccess": true,
"Message": "Object was created"
}

Comments

This request allows user to attach a Service Form to specific Customer. The response has standard format, it contains Id and IsSuccess fields. Id should be persisted somewhere for future usage.

  Get All Customers Service Forms
URL /ServiceForm/Customer/{customerId}
Method GET
Body

 

Response

[
{
"CustomName": null,
"CustomerId": 1,
"Id": 1,
"ServiceFormId": 1
}
]

Comments

This request allows user to get all Service Forms attached to specific Customer.

  Fill field Customers Service Forms
URL /CustomerServiceForm/Fill
Method PUT
Body

 

If field's type is either Text, or Number, or Date, or Time
{
"AttachedServiceFormId":2, //This is the Customer Service Form Id mentioned in the example above
"ServiceFormFieldId":3,
"Value":"test"
}

If field's type is either List or Multi-List
{
"AttachedServiceFormId":1003,
"ServiceFormFieldId":13,
"SelectedListItems":["Item 2"] //for List this array should contain single element
}

If field's type is either Attachment or Signature
{
"AttachedServiceFormId":1003,
"ServiceFormFieldId":13,
"File":
{
"FileName":"attach.png",
"ContentType":"image\/png"
}
}

Response

{
"Data": null,
"Id": 1,
"IsSuccess": true,
"Message": "Object was created"
}

NOTE. If user sends File property then the response will contain Data field with random GUID. This GUID should be persisted for future usages (e.g. file upload/download)

Comments

This request allows user to fill the value for one field of Customer Service Form.

  Get all field values of Customer Service Form
URL /CustomerServiceForm/{customerServiceFormId}
Method GET
Body

 

Response

Response:

[
{
"AttachedServiceFormId": 1003,
"File": null,
"Id": 1002,
"SelectedListItems": null,
"ServiceFormFieldId": 12,
"Value": "test"
},
{
"AttachedServiceFormId": 1003,
"File": null,
"Id": 1003,
"SelectedListItems": [
"Item 2"
],
"ServiceFormFieldId": 13,
"Value": null
},
{
"AttachedServiceFormId": 1003,
"File": {
"ContentType": "image\/png",
"FileName": "image\/png",
"FileNameInternal": "711b53cd-00af-46b5-bee1-bcba178b9d85"
},
"Id": 1004,
"SelectedListItems": null,
"ServiceFormFieldId": 14,
"Value": null
},
{
"AttachedServiceFormId": 1003,
"File": null,
"Id": 1005,
"SelectedListItems": null,
"ServiceFormFieldId": 15,
"Value": null
}
]

Comments

 

  Attach a Service Form to specific Work Order/Task
URL /ServiceForm/WorkOrder
Method POST
Body

 {
"WorkOrderId":1,
"ServiceFormId":1
}

Response

{
"Data": null,
"Id": 3,
"IsSuccess": true,
"Message": "Object was created"
}

Comments

This request allows user to attach a Service Form to specific Work Order/Task. The response has standard format, it contains Id and IsSuccess fields. Id should be persisted somewhere for future usage.

  Get all Service Forms attached to specific Work Order / Task
URL /ServiceForm/WorkOrder/{workOrderId} 
Method GET
Body

 

Response

[
{
"CustomName": null,
"WorkOrderId": 1,
"Id": 1,
"ServiceFormId": 1
},
{
"CustomName": null,
"WorkOrderId": 1,
"Id": 2,
"ServiceFormId": 1
}
]

Comments

This request allows user to get all Service Forms attached to specific Work Order / Task

  Fill the value for one field of Work Order Service Form
URL /WorkOrderServiceForm/Fill
Method PUT
Body

If field's type is either Text, or Number, or Date, or Time

{
"AttachedServiceFormId":2, //This is the Work Order Service Form Id mentioned in the example above
"ServiceFormFieldId":3,
"Value":"test"
}

If field's type is either List or Multi-List
{
"AttachedServiceFormId":1003,
"ServiceFormFieldId":13,
"SelectedListItems":["Item 2"] //for List this array should contain single element
}

If field's type is either Attachment or Signature
{
"AttachedServiceFormId":1003,
"ServiceFormFieldId":13,
"File":
{
"FileName":"attach.png",
"ContentType":"image\/png"
}
}

Response

{
"Data": null,
"Id": 1,
"IsSuccess": true,
"Message": "Object was created"
}

Comments

This request allows user to fill the value for one field of Work Order Service Form

  Get all field values of Work Order Service Form
URL /WorkOrderServiceForm/{workOrderServiceFormId}
Method GET
Body

 

Response

Response format is the same as for GET /CustomerServiceForm/{customerServiceFormId} response

Comments

This request allows user to get all field values of Work Order Service Form

  Download an attachment
URL /ServiceFormFieldFile/{fileNameInternal} 
Method GET
Body

 

Response

 

Comments

This request allows user to download an attachment. FileNameInternal is a GUID mentioned above multiple times.

  Upload an attachment
URL /ServiceFormFieldFile/{fileNameInternal}
Method POST
Body

 

Response

 

Comments

This request allows user to upload an attachment. FileNameInternal is a GUID mentioned above multiple times.

 

Here is example of C# code for uploading files to the REST service. 

FileStream stream = File.OpenRead(@"C:\Users\Public\Pictures\Sample Pictures\Desert.jpg");
 byte[] arr = new byte[stream.Length];
 stream.Read(arr, 0, System.Convert.ToInt32(stream.Length));
 stream.Close();
 
 WebClient client = new WebClient();
 client.Headers.Add("Content-Type", "image/jpeg");
 client.Headers.Add("ServerName", "a1plumbing");
 client.Headers.Add("Token", "8c591856-b88a-4f07-bb2c-c0d81e70a593");