0.12.1622

The majority of this build has been refining and increasing functionality for variable interpolation (referencing) in the REST connectors and Listener API configurations. REST Connectors:

  • Variable reference in documents. - you can now reference a variable in a document to get populated during the rest call. An example would be if you reference a string field in a document, say {{ pre.refField }}, and if the pre-request or prescript code generates a field called pre.refField, the value of this field will be substituted in for the variable in the document itself before posting.

  • We have updated the connector to now recognise references both as ${refField} or {{ refField }}. you can use which ever syntax you prefer.

  • Lastly we have implemented the ability to reference cookie values that might be found in a pre-request:

{{cookies.[cookieName].Value}}         // this will give you the value
{{cookies.[cookieName]}}         // this will give you the value same as above (short hand)
{{cookies.[cookieName].[otherPropertyOfCookie]}}        // this will give you other\properties of the cookie

Property list can be found in the properties section of this page.

Listener Updates

We had a conflict previoulsy where using the internal query vs the external query listeners involved slightly different syntax. This build has rectified this, allowing the internal query listeners to have access to the same functionality as the external listeners. You can now also control the field type of a parameter being used. Here is a breakdown of the internal query functionality available:

{
  "IgnoreExpiry": "{{ignoreExpiry}}", // boolean optional
  "IncludeHeader": "true", // boolean optional
  "Page": "{{page}}", // optional
  "PageSize": "{{pageSize}}", // optional
  "PipelineStageDefinitions": [ { "$match" : { "field" : "{{number}}" } } ], // same as 'Aggregate.Pipeline'
  "Aggregate": {
    "Pipeline": [] // same as 'PipelineStageDefinitions'
  },
  "Parameters": {
    "pageSize": {
      "DefaultValue": 100, // default to null
      "Format": "D", // default to null
      "UrlEncode": false, // default to false
    },
    "number": {
      "DefaultValue" : 0,
      "TryParse": true // default to false
    }
  }
}

You now have access to include or exclude header data, as well as expired documents, these will now default as false if not specified.

The biggest change is the "TryParse" config. If a DefaultValue is specified, Utopia will always TryParse the value of the parameter to match that of the DefaultValue. If the default value is a number, it will try as a number etc. However this might not always work for your scenario, so you can manually set TryParse as true or false. If TryParse is set to false, it will always post the value as a string

If TryParse is set to true, then it will pass the value though to the utopia interpolator and will assign it accordingly. These can be useful when trying to add Page and PageSize values which need to be int values. This also goes for scenarios where you are looking to use size and limit functions within the Aggregate itself.

External query Listener

While we have not made any changes to this, I wanted to give a refresh example of the fields allowed in comparison to the above:

{
  "IgnoreExpiry": true, // boolean optional
  "IncludeHeader": "true", // boolean optional
  "Page": 0, // optional
  "PageSize": 100, // optional,
  "FilterDefinition": "{_id: { $gt: ObjectId('61dfdbbcb700290001014f21')}}",
  "PipelineStageDefinitions": [ { "$match" : { "field" : "{{number}}" } } ],
  "Sort": [    {      "Field": "_id",      "Direction": 1    }  ]  
}

Last updated