Create Records

Introduction

This document covers creating a record against a form that has already been created and released. For more information on how to generate forms via the API please refer to the Form Definition Section.

Getting Started

All API requests require an authorization token – reference our Authentication page for more information


📘

Note

Forms may have additional formatting, like sections or field groups like the example screenshot’s Safety Review. These additional formatting options are for a manual users’ benefit but will cause additional nesting in the form definition response. When designing forms that will have their records created only by API it is recommended these formatting features are not used.

Dependency rules and expressions will not be provided in the response, but rules will be evaluated at server side when a user submits data.

Create Records / Submit Form Data - High Volume

Create a record using the form definition response from the previous section of this document. This request is limited to Check and Audit type forms. The SubmitRecord API request accepts the same format as AddSubmitFormRequest. Requests submitted with SubmitRecord are NOT visible in the Admin Tools – Data Provisioning Import UI. The maximum number of SubmitRecord submissions is 400 per minute.

API Structure

POST api/integration/SubmitRecord

Required Request Parameters

NameLocationDescription
Authorization TokenHeaderSee Login Authentication API documentation
Form RefBodyForm Name
ResourceBodyResource Name, only one may be selected
LocationBodyLocation Name linked to a Resource, only one may be selected
Form DetailsBodyFor each field on the form include the shortname and value to be passed for that field – use GetRecordFormDefinition to view which fields to pass
OperationBodyAlways use value Insert to create a record

Optional Request Parameters

NameLocationDescription
SubmittedDateBodyThe SubmittedDate may be included but it must be provided in UTC. When the record is processed the SubmittedDate provided in the request will be used to update the SubmittedDate in the record, if the SubmittedDate is not provided then the system will set SubmittedDate to ProcessedDate.
RequestNoBodyThe RequestNo may be included in the JSON request. This is an Alpha/Numeric value that can be include to assist with identifying the request when multiple requests are included in the sample payload.

Request JSON single record

{
  "Data": {
    "RecordSummaryDetail": [
      {
        "FormRef": {
          "Name": "Weight Sample Check"
        },
        "Resource": {
          "Name": "Rye Flour"
        },
          "Location": {
          "Name": "Site"
        },
        "RecordData": {
          "FormDetails": [
            {
              "Value": "1 lb",
              "ShortName": "Bag Size"
            },
            {
              "Value": "1.15",
              "ShortName": "Sample Weight Check"
            }
          ]
        }
      }
    ]
  },
  "Operation": "Insert",
  "Status": true,
  "Errors": null,
  "RefreshToken": false,
  "PartialSuccess": true
}

Example with SubmittedDate Parameter

{
    "Data": {
        "RecordSummaryDetail": [{
                "FormRef": {
                    "Name": "Weight Sample Check"
                },
                "Resource": {
                    "Name": "Rye Flour"
                },
                "Location": {
                    "Name": "Site"
                },
                "RecordData": {
                    "FormDetails": [{
                            "Value": "1 lb",
                            "ShortName": "Bag Size"
                        }, {
                            "Value": "1.15",
                            "ShortName": "Sample Weight Check"
                        }
                    ]
                },
                "SubmittedDate": "12-16-2020 05:29:05"
            }
        ]
    },
    "Operation": "Insert",
    "Status": true,
    "Errors": null,
    "RefreshToken": false,
    "PartialSuccess": false
}

Example with RequestNo Parameter

{
  "Data": {
    "RecordSummaryDetail": [
      {
        "RequestNo": "1",
        "FormRef": {
          "Name": "Weight Sample Check"
        },
        "Resource": {
          "Name": "Rye Flour"
        },
        "Location": {
          "Name": "Site"
        },
        "RecordData": {
          "FormDetails": [
            {
              "Value": "1 lb",
              "ShortName": "Bag Size"
            },
            {
              "Value": "1.15",
              "ShortName": "Sample Weight Check"
            }
          ]
        },
        "SubmittedDate": "12-16-2020 05:29:05"
      }
    ]
  },
  "Operation": "Insert",
  "Status": true,
  "Errors": null,
  "RefreshToken": false,
  "PartialSuccess": false
}

Response Parameters

NameDescription
RecordsUse these record GUID within the GetSubmitRecordStatus API to request updates on the status of the SubmitRecord request. Refer to the GetSubmitRecordStatus API section of this document for more information.
RequestStatusIf no syntax errors are present the default response is Pending until the request can be processed.
RequestErrorError object providing information if an error occurs
DetailedErrorError object providing information if an error occurs
StatusIndicating the success of the API request
ErrorsError object providing information if an error occurs
RefreshTokenReturns false and is reserved for SCS future use

Response JSON

{
    "Records": [
        "54C604E6-EB2F-4BF9-9CEB-2B9F2D399929",
        "EE4ED9DB-579C-4C3C-91B5-03D2514931A8",
        "986A632D-2C85-4C3D-8296-9D611ED849FD"
    ],
    "RequestStatus": "Pending",
    "RequestError": null,
    "DetailedError": null,
    "Status": true,
    "Errors": null,
    "RefreshToken": false
}

Response JSON with RequestNo

{
  "Records": [
    {
      "RecordId": "54C604E6-EB2F-4BF9-9CEB-2B9F2D399929",
      "RequestNo": "1"
    },
    {
      "RecordId": "EE4ED9DB-579C-4C3C-91B5-03D2514931A8",
      "RequestNo": "2"
    },
    {
      "RecordId": "986A632D-2C85-4C3D-8296-9D611ED849FD",
      "RequestNo": "3"
    }
  ],
  "RequestStatus": "Pending",
  "RequestError": null,
  "DetailedError": null,
  "Status": true,
  "Errors": null,
  "RefreshToken": false
}