GoPlant API: Get Responses after the LastUpdated UTC date for an External Tag Source Code
  • Description / Endpoint Version: 1.0
    This endpoint will return a list of responses after the Last Updated UTC date and are associated with an external tag source code. This endpoint was designed to work with a historian or logbook system.
  • Change Log:
    • 1.0: Initial build.
    • API 2.0: For any of the endpoints that require a start and end date / time, you can now pass a storage group date / time with "StartDatetimeSG" and "EndDatetimeSG" instead of "StartDatetimeUTC" and "EndDatetimeUTC". Include "StorageGroupID" to tell the system which storage group date / time you are sending.

  • Authentication Type:
    Tag Source
  • Accepts:
    URL: http://demo.goplant.mobi/api/svc/Historian/HistorianAfterResponseLastUpdated
    Method: Post
    Authorization: Basic
    • Username: [Contact The GoPlant Administrator]
    • Password: [Contact The GoPlant Administrator]
    Headers:
    • Content-Type: application/json
    Body:
    • RowStart and RowCount are used for paging thru large record sets. The maximum number of rows that can be returned at any one time is 1000.
    • RowStart: This is a zero based row number of the row to start with.
    • RowCount: The number of rows to return starting from the RowStart.
    • ReturnType: How you would like to receive the response. JSON and XML are supported.
    • LastUpdatedUTC: The Last Response Updated UTC date. This endpoint will return records after this Response Last Updated date.
    • LastUpdatedSG: The Last Response Updated date. This endpoint will return records after this Response Last Updated date.
    • TagSourceCodeName: The external tag source code you would like to request.
    • TagDataValue: (Optional) The external tag data value you would like to request.
    • EndpointVersion: The endpoint version that you want to call. Leaving this blank will call the most recent 2.x version.
    • Note: For endpoints that allow a date parameter, you can now use "StartDatetimeSG" or "EndDatetimeSG" to pass storage group timestamps. See the home page for more details.
    Accept Body Example:
    {
    	"RowStart": 0,
    	"RowCount": 3,
    	"ReturnType": "json",
    	"LastUpdatedUTC": "2018-05-25T15:50:00",
    	"LastUpdatedSG": null,
    	"TagSourceCodeName": "UNITECH",
    	"TagDataValue": "",
    	"EndpointVersion": null (null = latest 2.2)
    }
    
  • Response:
    Status: 200
    Type: JSON
    Body:
    • Status Object: Holds status information about your request.
      • HTTPStatusCode: HTTP Status ID of the request.
      • HTTPStatus: HTTP Status string representation. EX. 'OK'
      • RowStart: The zero based first row that was returned.
      • RowsReturned: The actual number of rows returned in the Data object.
      • LastIdReturned: The Last Response ID Returned by this request. This is useful for the next call when you want new records.
      • RequestBegin: The UTC timestamp API received the request.
      • StopWatch: The elapsed time the API call.
      • APIversion: GoPlant internal API version.
      • EndpointVersionReturned: The endpoint version that was returned based on the request. ex. If no endpoint version was requested, this will show the latest 1.x version.
      • ExternalRequest: The request object that was passed. Includes the endpoint version that was requested and the actual endpoint version that was returned.
        • "EndpointVersion": null
        • "EndpointVersionReturned": 1.1
    • Data Object: Holds the actual data that you are requesting.
      • responseID: Unique Response ID
      • responseType: A string representing our possible response types, which may be Short text, Scan barcode, Drawing, Previous, Show message, Calculation, Multi-line text, Take picture, Lookup, Location, Signature, List, Date, Yes/No, Number
      • responseValue: The string value of the response.
      • responseDate: The UTC date / timestamp the questions step was answered.
      • stepComments: Administrator comments when the step was added to the form.
      • stepWasVisible: Indicates whether the step was visible on the form at the time it was committed. May be null for responses committed before 6/13/2018.
      • formName: Name of the form.
      • assetTag: Name of the Asset. May be null if the response was on a Form Only round.
      • assetDescription: Description of the Asset. May be null if the response was on a Form Only round.
      • assetStatus: String representation of the Assets status. May be null, Nominal, NonNominal or Disabled.
      • roundName: Name of the Round
      • roundVariantName: Name of the variant in the round.
      • elementLabel: Name of the element in the variant in the round.
      • taskName: Name of the task. May be null if the response was in a round and not a task.
      • taskEventStatus: String representation of the tasks status at the time the response was recorded which may be Revoked, CompleteLate, Late, Expired, On Time, Void, Not Started, Completed
      • tagSourceCode: External tag source code.
      • tagSourceDisplayName: People friendly display of the external tag source code. May be null.
      • tagDataValue: Value of the external tag.
      • tagDataDescription: People friendly display of the external tag. May be null.
      • operatorFullName: Full name of the operator that answered this response
      • completedFormID: Use this id to group responses by a completed form.
      • completedRoundID: Use this id to group responses by a completed round.
      • completedRoundElementID: Use this id to group responses by a round / element combination
      • taskEventID: Use this id to group responses by a task event. Note: will be 'null' if response was not part of a task.
      • timeZone: Timezone the response was completed in.
      • lastUpdated: Response Last Updated UTC date / timestamp.
      • responseLabel: The label of the step associated with this response.
      • roundStorageGroupID: Storage Group id of this records round.
      • roundStorageGroupName: Storage Group name of this records round.
      • roundStartDate: UTC date / timestamp when the round was started.
      • roundEndDate: UTC date / timestamp when the round was completed.
    Response Example:
    {
        "status": {
            "HTTPStatusCode": 200,
            "HTTPStatus": "OK",
            "RowStart": 0,
            "RowsReturned": 3,
            "LastIdReturned": 259761,
            "RequestBegin": "2019-05-07T20:21:50.7536514Z",
            "StopWatch": {
                "IsRunning": true,
                "Elapsed": "00:00:00.0831032",
                "ElapsedMilliseconds": 83,
                "ElapsedTicks": 843331
            },
            "APIversion": "5.13.0.0",
            "EndpointVersionReturned": 2.2,
            "ExternalRequest": {
                "RowStart": 0,
                "RowCount": 3,
                "LastUpdatedUTC": "2018-05-25T15:5",
                "TagSourceCodeName": "HACHWIMS",
                "ReturnType": 1,
                "EndpointVersion": null,
                "EndpointVersionReturned": 2.2
            }
        },
        "data": [
            {
                "responseID": 259759,
                "responseType": "Number",
                "responseValue": "73.00",
                "responseDate": "2018-05-25T15:55:49",
                "stepComments": "Step Note spot",
                "stepWasVisible": null,
                "formName": "U1FEXT",
                "assetTag": "U1FEXTINGUISHER08",
                "assetDescription": null,
                "assetStatus": "Nominal",
                "roundName": "Safety Round",
                "roundVariantName": "Shift1",
                "elementLabel": "U1FEXTINGUISHER08 / U1FEXT",
                "taskName": "",
                "taskEventStatus": "",
                "tagSourceCode": "HACHWIMS",
                "tagSourceDisplayName": "Hach WIMS",
                "tagDataValue": "Hach WIMS Asset01",
                "tagDataDescription": "Hach WIMS Asset01",
                "operatorFullName": "Max Admin",
                "completedFormID": 29182,
                "completedRoundID": 7816,
                "completedRoundElementID": 48954,
                "taskEventID": null,
                "timeZone": "America/Chicago",
                "lastUpdated": "2018-05-25T15:55:49",
                "responseLabel": "number_1",
                "roundStorageGroupID": 425,
                "roundStorageGroupName:"TXRG1",
                "roundStartDate": "2018-05-23T11:05:48.84",
                "roundEndDate":   "2018-05-23T13:04:48.84"
            },
            {
                "responseID": 259760,
                "responseType": "List",
                "responseValue": "Class B",
                "responseDate": "2018-05-25T15:55:21",
                "stepComments": "Step Note spot",
                "stepWasVisible": null,
                "formName": "U1FEXT",
                "assetTag": "U1FEXTINGUISHER08",
                "assetDescription": null,
                "assetStatus": "Nominal",
                "roundName": "Safety Round",
                "roundVariantName": "Shift1",
                "elementLabel": "U1FEXTINGUISHER08 / U1FEXT",
                "taskName": "",
                "taskEventStatus": "",
                "tagSourceCode": "HACHWIMS",
                "tagSourceDisplayName": "Hach WIMS",
                "tagDataValue": "Hach WIMS Asset02",
                "tagDataDescription": "Hach WIMS Asset02",
                "operatorFullName": "Max Admin",
                "completedFormID": 29182,
                "completedRoundID": 7816,
                "completedRoundElementID": 48954,
                "taskEventID": null,
                "timeZone": "America/Chicago",
                "lastUpdated": "2018-05-25T15:55:21",
                "responseLabel": "list_1",
                "roundStorageGroupID": 425,
                "roundStorageGroupName:"TXRG1",
                "roundStartDate": "2018-05-23T11:05:48.84",
                "roundEndDate":   "2018-05-23T13:04:48.84"
            },
            {
                "responseID": 259761,
                "responseType": "Yes/No",
                "responseValue": "No",
                "responseDate": "2018-05-25T15:55:30",
                "stepComments": "Step Note spot",
                "stepWasVisible": null,
                "formName": "U1FEXT",
                "assetTag": "U1FEXTINGUISHER08",
                "assetDescription": null,
                "assetStatus": "Nominal",
                "roundName": "Safety Round",
                "roundVariantName": "Shift1",
                "elementLabel": "U1FEXTINGUISHER08 / U1FEXT",
                "taskName": "",
                "taskEventStatus": "",
                "tagSourceCode": "HACHWIMS",
                "tagSourceDisplayName": "Hach WIMS",
                "tagDataValue": "Hach WIMS Asset03",
                "tagDataDescription": "Hach WIMS Asset03",
                "operatorFullName": "Max Admin",
                "completedFormID": 29182,
                "completedRoundID": 7816,
                "completedRoundElementID": 48954,
                "taskEventID": null,
                "timeZone": "America/Chicago",
                "lastUpdated": "2018-05-25T15:55:30",
                "responseLabel": "YesNo_1",
                "roundStorageGroupID": 425,
                "roundStorageGroupName:"TXRG1",
                "roundStartDate": "2018-05-23T11:05:48.84",
                "roundEndDate":   "2018-05-23T13:04:48.84"
            }
        ]
    }
    
  • On Failure:
    • If you do not provide a basic authorization header you will get an empty body with a status of 401 Unauthorized.
    • If your basic authorization header Username or Password is incorrect, you will get this message with a status of 401 Unauthorized.
      {"message": "Unauthorized API access"}
    • If you do not supply a json object in your body, you will get this message with a status of 500 Internal Server Error.
      {"message": "Missing body in post."}
    • If you pass a RowStart less than zero, you will get this message with a status of 500 Internal Server Error.
      {"message": "RowStart cannot be less than 0."}
    • If you pass a RowCount less than zero, you will get this message with a status of 500 Internal Server Error.
      {"message": "RowCount cannot be less than 0."}
    • If TagSourceCodeName is required and you do not pass it, you will get this message with a status of 500 Internal Server Error.
      {"message": "You must pass a source code name."}
    • If a Start, End or last update date / time is required but not passed, you will get this message with a status of 500 Internal Server Error.
      {"message": "StartDatetimeUTC cannot be null"}
      OR
      {"message": "EndDatetimeUTC cannot be null"}
      OR
      {"message": "LastUpdateUTC cannot be null"}
    • If you pass an invalid version number, you will get this type of response.
      {"message": "ResponsesBetweenResponseDate Error: Invalid Version Requested [1.1].   at ...
    • If you do not pass a TagSourceCodeName you will get this message and a status of 500 - Internal Server Error.
       {"message":"You must pass a source code name."}
  • curl Example:
                            
    curl -X POST \
      http://localhost:9080/api/svc/Historian/HistorianAfterResponseLastUpdated \
      -H 'Authorization: Basic R29QbGFudEV4dGVybmFsQWNjZXNzOjc3NjRFRDE3Q0QyODRGNzhBNDYy' \
      -H 'Cache-Control: no-cache' \
      -H 'Content-Type: application/json' \
      -d '{
    	"RowStart": 0,
    	"RowCount": 4,
    	"ReturnType": "json",
        "LastUpdatedUTC": "2018-05-25T15:5",
    	"TagSourceCodeName": "MAXIMO"
    }'
                        
  • C# Example:
                            
    var client = new RestClient("http://localhost:9080/api/svc/Historian/HistorianAfterResponseLastUpdated");
    var request = new RestRequest(Method.POST);
    request.AddHeader("Cache-Control", "no-cache");
    request.AddHeader("Authorization", "Basic R29QbGFudEV4dGVybmFsQWNjZXNzOjc3NjRFRDE3Q0QyODRGNzhBNDYy");
    request.AddHeader("Content-Type", "application/json");
    request.AddParameter("undefined", "{\n\t\"RowStart\": 0,\n\t\"RowCount\": 4,\n\t\"ReturnType\": \"json\",\n\t\"LastUpdatedUTC\":\"2018-05-25T15:50:00\",\n\t\"TagSourceCodeName\": \"MAXIMO\"\n    \"EndpointVersion\": 1.1\n}", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
                        
  • Jquery Example:
                            
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "http://localhost:9080/api/svc/Historian/HistorianAfterResponseLastUpdated",
      "method": "POST",
      "headers": {
        "Content-Type": "application/json",
        "Authorization": "Basic SEFDSFdJTVM6REVWTC5URVNUREVWRUxPUE1FTlRLRVk=",
        "cache-control": "no-cache"
      },
      "processData": false,
      "data": "{\n  \"RowStart\": 0,\n  \"RowCount\": 3,\n  \"ReturnType\": \"json\",\n\ "LastUpdatedUTC\":\"2018-05-25T15:50:00\",\n  \"TagSourceCodeName\": \"HACHWIMS\"\n}"
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });