PortX APIs

Clients often want to interact with PortX programmatically to automate their processing tasks. PortX has two distinct APIs that clients can call:

PortX Query Language

Resources having the Searchable trait can be queried through the q query parameter using PortX Query Language (TRQL). TRQL is a SQL-like language giving you the ability to search for resources by fields other than the resource ID. Before diving into the syntax, here are a few examples of queries expressed in TRQL:

name == 'AS2 Receive'
documentPropertyValue =like= 'GearCo%'
processedAt > '2016-04-29 00:00:00' and processedAt <= '2016-04-29 00:00:01'
standard =in= ('X12', 'EDIFACT') and (direction == 'INBOUND' or messageType == 'PO') and processedAt >= '2016-01-01 00:00:00'

A TRQL expression is composed of one or more comparisons, related to each other with logical operators:

  • Logical AND: and

  • Logical OR: or

By default, the AND operator takes precedence, that is, it is evaluated before any OR operators are. However, a parenthesized expression can be used to change the precedence, yielding whatever the contained expression yields.

A comparison is composed of a selector, an operator, and an argument:

comparison = selector, comparison operator, arguments

TRQL Selector

A selector identifies a field of the resource representation to filter by. It can be any non-empty Unicode string that does not contain reserved characters (see below) or a white space.

TRQL Comparison Operator

A comparison operator can be any one of the following:

  • Equal to: ==

  • Not equal to: !=

  • Less than: <

  • Less than or equal to: <=

  • Greater than operator: >

  • Greater than or equal to: >=

  • In: =in=

  • Like: =like=

TRQL Argument

An argument can be a single value, or multiple values in parenthesis separated by comma. Multiple values can only be used with operators that support such argument types like the IN operator. An argument value that does not contain any reserved character or a white space can be unquoted, other arguments must be enclosed in single or double quotes.