OData Querying

Upodi has specific OData querying enabled endpoints, which means OData querying will not be enabled on any other endpoints than these. OData is a common standard within REST APIs and more information on OData Querying is available here.

GET
https://api.upodi.io/v3/customers/query

Available OData Query Parameters

Option

Description

$top

Returns only the first n the results.

$skip

Skips the first n results.

$select

Selects which properties to include in the response.

$orderby

Sorts the results.

$expand

Expands related entities inline. These are arrays of objects and object properties.

$filter

Filters the output.

Read more here. Examples are on your left

Encaptulations

To query data types using $filter in Odata, some data require encaptulations. Use the list below.

Data Type

Format

Example

Guid

guid'{value}'

guid'7A0555DA-A513-4B64-B1D5-EF9189A0220C'

DateTime

DateTime'{value in utc}'

DateTime'2012-05-29T09:13:28'

GET https://api.upodi.io/v3/invoices/query?$expand=InvoiceLines&$filter=CustomerID eq guid'aaaef347-1f57-4b1c-9528-57763e307c63' HTTP/1.2 

// Get all Invoices with expanded Invoice Lines for a specific customer
## Retrieve all invoices for specific customer

curl 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer <base64 key>" 
  https://api.upodi.io/v3/invoices/query?$expand=InvoiceLines&$filter=CustomerID eq guid'aaaef347-1f57-4b1c-9528-57763e307c63'
GET https://api.upodi.io/v3/subscriptions/query?$filter=CustomerID eq guid'0b5e2a3f-9845-4efb-a96d-2e20c04c7140' HTTP/1.2

// Retrieve all subscriptions of a specific customer
## Retrieve all subscriptions of a specific customer

curl 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer <base64 key>" 
  https://api.upodi.io/v3/subscriptions/query?$filter=CustomerID eq guid'0b5e2a3f-9845-4efb-a96d-2e20c04c7140'
GET https://api.upodi.io/v3/productplans/query?$expand=ProductPlanCharges/ProductPlanChargePricings&$select=ProductPlanCharges/ProductPlanChargePricings HTTP/1.2

// Retrieve prices for a specific
curl 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer <base64 key>" 
  https://api.upodi.io/v3/productplans/query?$expand=ProductPlanCharges/ProductPlanChargePricings&$select=ProductPlanCharges/ProductPlanChargePricings
GET https://api.upodi.io/v3/invoices/query?$filter=PaymentStatus eq 'NotPaid' and DueDate le datetime'2018-11-30T00:00:00' HTTP/1.2

// When filtering on enum types it requires you to refer to the actual state. For example PaymentStatus on the Invoice-object requires you search for 'NotPaid' and not the enum of 0.
curl 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer <base64 key>" 
  https://api.upodi.io/v3/invoices/query?$expand=InvoiceLines&$filter=CustomerID eq guid'aaaef347-1f57-4b1c-9528-57763e307c63'