doForms REST Web Service API

doForms REST Web Service API

Documentation has moved

The doForms REST API documentation has moved to https://mydoforms.appspot.com/openapi/openapi.html

 

The doForms REST API provides integration with the doForms system.

The doForms SOAP API documentation can be found here.

URL


The doForms REST API is located at

https://api-dot-mydoforms-hrd.appspot.com/api/v2

Sample Code


Java REST Sample Code

C# REST Sample Code

Authorization


Unless noted otherwise, all requests must include an Authorization header with the value "Bearer [token]".

cURL

--header 'Authorization: Bearer [token]'

jQuery

"headers": {"Authorization": "Bearer [token]"}

Python

headers = {'Authorization': 'Bearer [token]'}

Java

httpURLConnection.setRequestProperty("Authorization", "Bearer [token]");

C#

httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", [token]);

There are four options for obtaining a token:

User token

Obtain a user token by posting web user credentials to the /tokens/user endpoint described below. Requests with a user token will inherit the rights of the user account.

Web service token

Obtain a web service token by posting web service credentials to the /tokens/webservice endpoint described below. Requests with a web service token will have access to the project and form of the web service.

Web service

Build a static token by combining a web service ID and web service password separated by a colon. Requests with a static token will have access to the project and form of the web service.

Example:

  • Web service ID: acme$$1234$$Published$$5678

  • Password: mypassword

  • Token: acme$$1234$$Published$$5678:mypassword

Reseller token

Obtain a reseller token by posting reseller credentials to the /tokens/reseller endpoint described below.

Requests with a reseller token have access to account management endpoints for the customers of the reseller:

  • GET /accounts

  • GET /accounts/{key or code}

  • PUT /accounts/{key or code}

  • GET /devices?account={key or code}

  • GET /devices/{key or number}?account={key or code}

  • GET /users?account={key or code}

  • GET /users/{key or email}?account={key or code}

Endpoints


GET /accounts?

Response

Notes

Response

Notes

[
{
"key": "abc123",
"code": "acmeinc",
"administrator": {
"email": "me@me.com",
"firstName": "Bob",
"lastName": "Smith",
"workPhone": "1111111111"
},
"branded": true,
"credits": 10,
"licenses": 1,
"name": "Acme Inc Corp Ltd Pty",
"plan": {
"code": "pre02",
"name": "Premium"
},
"status": "Paid",
"active": true
},
{
"key": "abc124",
"code": "democo",
"administrator": {
"email": "me@me.com",
"firstName": "Bob",
"lastName": "Smith Jr",
"workPhone": "+5551231234"
},
"branded": true,
"credits": 10,
"licenses": 1,
"name": "Test company",
"plan": {
"code": "dem02",
"name": "Demo"
},
"status": "Canceled",
"active": false
}
]

Query customer accounts.

Requires reseller authentication.

  • Possible query fields:

    • administrator.email

GET /accounts/current

Response

Notes

Response

Notes

{
"key": "abc123",
"code": "acmeinc",
"administrator": {
"email": "me@me.com",
"firstName": "Bob",
"lastName": "Smith",
"workPhone": "1111111111"
},
"branded": true,
"credits": 10,
"licenses": 1,
"name": "Acme Inc Corp Ltd Pty",
"plan": {
"code": "pre02",
"name": "Premium"
},
"status": "Paid",
"active": true
}

Returns information about the current account.

  • Requires user authentication.

GET /accounts/{key or code}

Response

Notes

Response

Notes

{
"key": "abc123",
"code": "acmeinc",
"administrator": {
"email": "me@me.com",
"firstName": "Bob",
"lastName": "Smith",
"workPhone": "1111111111"
},
"branded": true,
"credits": 10,
"licenses": 1,
"name": "Acme Inc Corp Ltd Pty",
"plan": {
"code": "pre02",
"name": "Premium"
},
"status": "Paid",
"active": true
}

Get the account. 

  • Requires reseller authentication.

PUT /accounts/{key or code}

Body

Notes

Body

Notes

{
"active": true
}

Update the account.

  • active - Set to true to activate the account, false to deactivate the account. Requires reseller token authentication.

  • requires reseller authentication.

GET /activity?

Response

Notes

Response

Notes

[
{
"key": "act124",
"submissionKey": "abc123",
"projectKey": "pqr123",
"formKey": "fgh123",
"receiveTime": "2019-08-20T15:35:19.139-04:00",
"type": "update",
"submissionId": "acme$$12345$$Published&&1",
"submissionName": "My name | 3",
"projectName": "Main Project",
"formName": "First Form v1",
"userId": "me@me.com",
"userName": "My Name"
},
{
"key": "act123",
"submissionKey": "abc123",
"projectKey": "pqr123",
"formKey": "fgh123",
"receiveTime": "2019-08-20T14:38:54.896-04:00",
"type": "new",
"submissionId": "acme$$12345$$Published&&1",
"submissionName": "My name | 3",
"projectName": "Main Project",
"formName": "First Form v1",
"userId": "5551231234",
"userName": "Device one"
}
]

Returns all submission activity the user has access to.

  • Required query parameters:

    • @beginTime - ISO formatted date/time inclusive

    • @endTime - ISO formatted date/time exclusive

  • Requires user authentication.

  • To query activity by device, form or project, see the these endpoints:

    • GET /devices/{key or number}/activity?

    • GET /forms/{key or id}/activity?

    • GET /projects/{key}/activity?

GET /devices?

Response

Notes

Response

Notes

[
{
"key": "def123",
"name": "Device one",
"email": "me@me.com",
"number": "5551231234",
"teamKey": "tuv123"
},
{
"key": "def234",
"name": "Device two",
"email": "you@you.com",
"number": "5551234321",
"teamKey": "tuv123",
"lastTrack": {
"date": "2018-06-29T11:56:26.000Z",
"offset": -240,
"status": "MOVING",
"position": {
"accuracy": 20.885,
"altitude": 304.899,
"latitude": 34.101222,
"longitude": -84.0015005
},
"velocity": {
"bearing": 31.2198,
"direction": "NNE",
"distance": 489.332,
"speed": 7.6032
}
}
}
]

Returns all devices the user has access to.

  • Get a more limited list of devices at /teams/{key}/devices.

  • If the device has GPS tracking enabled, the last track received is returned in lastTrack.

  • Optional query parameters: latitude, longitude

    • If a device has a lastTrack node, return the distance to the provided latitude and longitude in lastTrack.distanceToTarget.

  • Requires user authentication.

GET /devices/{key or number}

Response

Notes

Response

Notes

{
"key": "def123",
"number": "5551231234",
"name": "Device one",
"email": "me@me.com",
"teamKey": "tuv123"
}

Returns the requested device.

  • If number = "Available" the device license has not been assigned to a device.

  • Optional query parameters: latitude, longitude

    • If a device has a lastTrack node, return the distance to the provided latitude and longitude in lastTrack.distanceToTarget.

  • Requires user authentication.

GET /devices/{key or number}/activity?

Response

Notes

Response

Notes

[
{
"key": "act123",
"submissionKey": "abc123",
"projectKey": "pqr123",
"formKey": "fgh123",
"receiveTime": "2019-08-20T14:38:54.896-04:00",
"type": "new",
"submissionId": "acme$$12345$$Published&&1",
"submissionName": "My name | 3",
"projectName": "Main Project",
"formName": "First Form v1",
"userId": "5551231234",
"userName": "Device one"
}
]

Returns all submission activity for a device that the user has access to.

  • Required query parameters:

    • @beginTime - ISO formatted date/time inclusive

    • @endDate - ISO formatted date/time exclusive

  • Requires user authentication.

  • To query all activity, see the /activity? endpoint.

POST /dispatches

 

Body

Notes

 

Body

Notes

Request

{
  "ownerId": "5551231234",
"fields": [
{ "name": "Name",
"text": "My name"
},
{ "name": "Choose",
"text": "3"
},
{ "name": "Today_s_date",
"date": "2019-08-19"
},
{ "name": "Number",
"integer": 25
},
{ "name": "Customer_Table",
"rows": [
{"fields": [
{ "name": "Customer_ID",
"text": "32-151"
},
{ "name": "Customer_name",
"text": "ABC Companies"
}]},
{"fields": [
{ "name": "Customer_name",
"text": "Global Industries"
},
{ "name": "Customer_ID",
"text": "44-158"
}]
}]
}
}]
}

Add a new dispatch.

  • ownerId - (optional) Set the mobile number to receive the dispatch. If no mobile number is assigned, the dispatch will be set to Pending status.

  • fields - An array of fields to populate. All fields are optional.

    • Follow the structure of fields and rows of the form as retrieved from /dispatches/{key} or /submissions/{key}.

    • Only the "name" and the value properties ("text", "integer", "date", etc.) are required for each field.

  • Requires webservice authentication.

200 OK

{
"code": 200,
"key": "rst123",
"ownerKey": "def123",
"status": "Sent"
}

  • code - 200 for success.

  • key - The key of the dispatch. Retrieve the full dispatch at /dispatches/{key}.

  • ownerKey - The key of the device that will receive the dispatch if the ownerId field was populated.

  • status - Either "Sent" or "Pending"

Error

{
"code": 401,
"message": "HTTP 401 Unauthorized"
}

  • code - The HTTP code of the error.

  • message - The error message.

GET /dispatches?

Response

Notes

Response

Notes

[
{
"key": "rst123",
"id": "acme$$12345$$Published&&1"
},
{
"key": "rst124",
"id": "acme$$12345$$Published&&2"
}
]

Returns dispatch identifiers that match a query.

See /submissions? for more details.

  • Requires user or webservice authentication.

DELETE /dispatches/{key or id}

Response

Notes

Response

Notes

200 OK

Delete a dispatch.

  • Any related submission can be deleted at /submissions/{key or id}.

  • Requires user or webservice authentication.

GET /dispatches/{key or id}?

Response

Notes

Response

Notes

{ "key": "abc123",
  "id": "acme$$12345$$Published&&1",
  "name": "My name | 3",
  "type": "dispatch",
  "formKey": "fgh123",
  "formName": "First Form v1",
  "formVersion": 1.0,
  "offset": -240,
  "ownerId": "5551231234",
  "ownerName": "Device one",
  "ownerType": "device",
  "projectKey": "pqr123",
  "receiveTime": "2019-08-20T14:38:54.896-04:00",
  "sourceId": "me@me.com",
  "sourceName": "My Name",
  "sourceType": "user",
  "status": "On site",
  "statusTime": "2019-08-20T15:30:24.052-04:00",
  "systemStatus":"Viewed",  "timezone": "Eastern Daylight Time",  "updateTime": "2019-08-20T15:35:19.139-04:00",  "updateUser": "me@me.com",   "fields": [    { "name": "Name",      "data": "text",      "type": "text",      "text": "My name"     },    { "name": "Choose",      "data": "text",      "type": "choose_one",      "text": "3"    },    { "name": "Form_Title",      "data": "text",      "type": "label",      "text": "Form_Title"    },    { "name": "Today_s_date",      "data": "date",      "type": "date_time",      "date": "2019-08-19T00:00:00.000Z"    },    { "name": "Number",      "data": "integer",      "type": "numeric",      "integer": 25    },    { "name": "Customer_Table",      "data": "rows",      "type": "table",      "rows": [        { "index": 0,           "fields": [            { "name": "Customer_ID",              "data": "text",              "type": "lookup",              "text": "32-151"            },            { "name": "Customer_name",              "data": "text",              "type": "text",              "text": "ABC Companies"            } ]        },        { "index": 1,          "fields": [            { "name": "Customer_name",              "data": "text",              "type": "text",              "text": "Global Industries"            },            { "name": "Customer_ID",              "data": "text",              "type": "lookup",              "text": "44-158"            } ]        } ]    }}