Query Syntax
  • 22 May 2023
  • 1 Minute to read
  • Contributors
  • Dark
    Light

Query Syntax

  • Dark
    Light

Article Summary

VisualVault REST API Data Query Syntax

Search for specific API Results

HTTP endpoints (where noted) support the q={query} query string parameter which may be used to filter results.

Query Syntax

Boolean Operators

  • and
  • or

Comparison Operators

  • eq (equal)
  • ne (not equal)
  • gt (greater than)
  • ge (greater than or equal)
  • lt (less than)
  • le (less than or equal)
  • between
  • not
  • like

Set Operators

  • in
  • not in

String/Character values

  • % (wildcard)
  • substring(value,start index, length) (substring function)

Date Values

  • dateadd(date part,integer,date value) (Date addition function where date part can be: year,month,day,hour,minute,second)
  • substring(value,start index, length) (substring function)

Examples

Query syntax requirements: Query string parameter must be URL encoded

  • Field names must be enclosed in square brackets
  • Search criteria must be enclosed in single quotes

Example: Filter form data where from field [invoice no] = '12345'

syntax without URL encoding: q=[invoice no] eq '12345'

with URL encoding: q=%5Binvoice%20no%5D%20eq%20'12345'

Using the query string parameter

In this example we will make a request using the FormTemplates endpoint. Normally with this request without the query string parameter, the results will be a complete list of all Form Templates (see here). We will append the query string parameter to the end of the request URL and search for a template where 'name = Purchase Requisition - Template'. We will make sure the query string is url encoded as follows. Use %20 for spaces and %27 for single quotes.

curl -X GET  \
     -H "Content-Type: application/json"   \
     -H "Authorization: Bearer $AccessToken" \
https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}/formtemplates/?q=name%20eq%20%27Purchase%20Requisition%20-%20Template%27

The following is returned
{
  "meta": {
    "status": 200,
    "statusMsg": "OK",
    "method": "GET",
    "href": "https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}/formtemplates/?q=name eq 'Purchase Requisition - Template'"
  },
  "data": [
    {
      "href": "~/formtemplates/dc7e2924-7518-e211-92ad-000c29753f96",
      "dataType": "FormTemplate",
      "id": "dc7e2924-7518-e211-92ad-000c29753f96",
      "name": "Purchase Requisition - Template",
      "modifyDate": "2014-11-04T12:22:16.377",
      "modifyById": "{userId}",
      "modifyBy": "{userName}",
      "createDate": "2012-10-17T09:10:18.277",
      "createById": "{userId}",
      "createBy": "{userName}",
      "description": "Purchase Requisition",
      "revisionId": "80183524-7518-e211-92ad-000c29753f96",
      "revision": 1,
      "templateRevision": "1",
      "status": 1
    }
  ]
}

Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses