Sorting and Filtering

Many endpoints in the API have "Sort" and "Filter" parameters.

Sort

The "Sort" parameter is a list of sorting rules. Each rule has two fields: "field" and "dir"

"field" is the name of the field in the object you are sorting. Use dot notation for inner fields.

"dir" is the direction of the sorting with "asc" for ascending and "desc" for descending.

Filter

The "Filter" parameter is an object of filtering rules. It can contain nested filters for more complex needs.

The available operators are:
“eq” for equals
“gte” for greater than or equal to
“lte” for less than or equal to
“gt” for greater than
“lt” for less than
“neq” for not equal to

For text values you can also use:
“startswith”
“endswith”
“contains”

Example URL

Here’s an example of retrieving the first 1000 measurements that are of type “WELL AMPS” or of type “WELL VOLTS”, with only “WELL VOLTS” being between the two specified dates, all sorted by Effective Date descending and then Measurement Type Name ascending. Line breaks were added for readability.

Note the use of bracket "[]" notation in the URL to specify nested fields.

https://www.welltraq.com/api/v1/measurements
?take=1000
&skip=0
&filter[logic]=or
&filter[filters][0][field]=MeasurementType.Name
&filter[filters][0][operator]=eq
&filter[filters][0][value]=WELL AMPS
&filter[filters][1][logic]=and
&filter[filters][1][filters][0][field]=MeasurementType.Name
&filter[filters][1][filters][0][operator]=eq
&filter[filters][1][filters][0][value]=WELL VOLTS
&filter[filters][1][filters][1][field]=EffectiveDate
&filter[filters][1][filters][1][operator]=gte
&filter[filters][1][filters][1][value]=2022-01-01
&filter[filters][1][filters][2][field]=EffectiveDate
&filter[filters][1][filters][2][operator]=lt
&filter[filters][1][filters][2][value]=2022-02-09
&sort[0][field]=EffectiveDate
&sort[0][dir]=desc
&sort[1][field]=MeasurementType.Name
&sort[1][dir]=asc

Sample Code

C# Application

Simple Example

Windows PowerShell Script

Simple Example

Insert / Update / Delete Asset Example

Creating CSV Files

Bash Script

Simple Example

Excel Macro

Downloading Measurements