We recommend switching to the latest versions of Edge, Firefox, Chrome or Safari. Using Internet Explorer will result in a loss of website functionality.

Assure Controls trigger via Rest API

Comments

4 comments

  • Avatar
    Gerard Cafaro

    The field textDataItem is parsed as a string server-side, so it's throwing an HTTP 500 since it was set as an object. The value set as textDataItem will need to be enclosed in double quotes, along with escaping the nested double quotes.

    An example of the control execution and results are below. Note that API executions that contain API data won't write a catalog, so the catalogId returned is expected to be null, along with no execution listed under Results by Control Point. The results will still be written into the control's data table.

    {
    "controlEntityName": "basicjsonce",
    "controlPointName": "basicjsoncp",
    "sourceTimestamp": "2020-12-15T14:00:00.001-05:00",
    "waitForResponse": "true",
    "timeout": 60000,
    "textDataItem": "{\"field1\":\"value3\",\"field2\":\"value4\"}"
    }

    0
    Comment actions Permalink
  • Avatar
    Athar Syed

    Thanks for the response, get this error when i try escaping double quotes, 

    "error": {"messages": ["#UCAS017: The API request captured zero instances of control data."]}
    }

    are you using Assure Layout type External Service - Json2 Plugin? and Data Access Method as API Data?

    is there any Assure layout type that can capture textDataItem without using escaping double quotes? 

    {
    "controlEntityName": "SA_API_Capture_CE",
    "controlPointName": "basicjsoncp",
    "sourceTimestamp": "2020-12-15T14:00:00.001-05:00",
    "waitForResponse": "true",
    "timeout": "60000",
    "textDataItem": "{\"field1\":\"value5\",\"field2\":\"value6\"}"
    }

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Gerard Cafaro

    The UCAS017 refers to either the layout didn't find any fields in the input data that matched the layout's definitions or that the control didn't capture any data from the layout that matched the control's definitions. It did get further in processing this time around since it accepted the API and payload syntax instead of the HTTP 500.

    What do you have defined as the "location" for your layout's fields? These "locations" refer to the key value of the JSON data within textDataItem. For the textDataItem in both of our examples, the locations are field1 and field2. Within my layout, I named my fields the same value, but the Name value could differ from the Location:

    If the layout has the correct Location set for the fields, are the condition(s) within the control's capture met? These could vary greatly. I didn't add a condition; I set mine to "true" to capture all records. 

    To answer your other questions, yes, I'm using the Json2 plugin with API Data set as the Data Access Method. Escaping the double quotes comes from a JSON requirement of nested double quotes rather than a requirement specific to an Assure layout. 

     

     

    0
    Comment actions Permalink
  • Avatar
    Athar Syed

    Thanks Gerard, it did work by having a separate Control Entity and fields as keys. I was using an existing CE and CE fields for json layout as non ID fields.

    0
    Comment actions Permalink

Please sign in to leave a comment.