Guide API documentation Community Applications
Introduction
Authentication
Using the API
Filtering Hypermedia Troubleshooting Dimensions Files Statistics Webhooks Custom fields
Guides
Payroll
Legal

Query API-requests

In this article we will go through the different query options we have for requets on biz-routes.

You are able to combine all the key-words, you do this by seperating them with '&'

Queries we support

  • Filter
  • Select
  • Expand
  • Top
  • Skip

Filter

For filters we have support for these keywords:

Keyword
Meaning
Example
eqEqualsCustomerName eq 'unimicro'
neNot equalsCustomerName ne 'unimicro'
gtGreater thanSum gt 1000
ltLess thanSum lt 1000
geGreater or equalSum ge 1000
leLess or equalSum le 1000
likeLikeCustomerName like '%imicr%'
notlikeNot likeCustomerName notlike '%imicr%'
containsContainscontains(CustomerName,'micro')
startsWithStarts withstartsWith(CustomerName, 'uni')
endsWithEnds withendsWith(CustomerName, 'micro')

Examples for using filter

// Exact match
test.unimicro.no/api/biz/orders?filter=CustomerName eq 'unimicro'
test.unimicro.no/api/biz/orders?filter=VatTotalsAmount eq 50000

// Not equals
test.unimicro.no/api/biz/orders?filter=CustomerName ne 'unimicro'
test.unimicro.no/api/biz/orders?filter=StatusCode ne 41004
  
//Greater than
test.unimicro.no/api/biz/orders?filter=StatusCode gt 41004
test.unimicro.no/api/biz/orders?filter=VatTotalsAmount gt 50000
  
//Lesser than
test.unimicro.no/api/biz/orders?filter=StatusCode lt 41004
test.unimicro.no/api/biz/orders?filter=VatTotalsAmount lt 50000
  
//Greater or equal
test.unimicro.no/api/biz/orders?filter=StatusCode ge 41004
test.unimicro.no/api/biz/orders?filter=VatTotalsAmount ge 50000
  
//Lesser or equal
test.unimicro.no/api/biz/orders?filter=StatusCode le 41004
test.unimicro.no/api/biz/orders?filter=VatTotalsAmount le 50000
  
//Search with like (case insensitive)
test.unimicro.no/api/biz/orders?filter=CustomerName like '%imicr%'
test.unimicro.no/api/biz/orders?filter=CustomerName like 'Unimic%'
test.unimicro.no/api/biz/orders?filter=CustomerName like '%micro'
  
//Search with contains (case insensitive)
test.unimicro.no/api/biz/orders?filter=contains(CustomerName,'imicr')

//Search with starts with (case insensitive)
test.unimicro.no/api/biz/orders?filter=startsWith(CustomerName,'Uni')

//Search with ends with (case insensitive)
test.unimicro.no/api/biz/orders?filter=endsWith(CustomerName,'micro')

Expand

To be able to retrieve sub-entities you have to use the expand key-word.

Examples of expand

// To retrieve all orders with items test.unimicro.no/api/biz/orders?expand=Items //To retrieve one order with items test.unimicro.no/api/biz/orders/29?expand=Items // To retrieve all orders with items with products test.unimicro.no/api/biz/orders?expand=Items.Product // To retrieve all orders with customer and items with products test.unimicro.no/api/biz/orders?expand=Customer,Items.Product

So you can consider the expands as a hiearchy where the main entity is the starting point. Then you can expand children and childrens-children as deep as you would like. Items.Product.ProductCategoryLinks. This will expand Items, Product and ProductCategoryLinks. You can also expand siblings, this is done by seperating the siblings with ",", like this: Items, Customer,Dimensions. You can also combine these so you can expand items with sub-entitites and customer with sub-entitites, Customer.Info,Items.Product.ProductCategoryLinks

Top

Top is used the same way as in SQL; top=10 gives you the top 10 results.

Skip

Used for skipping results. Could be used to support pagination, skip=10&top=10 gives you results 11 to 20.

Select

Select can be used to create smaller return payloads that only contains the properties that you are interested in. Some properties will always be included; ID,Deleted and CustomValues.

Example Skip

// You seperate the properties you want to include by , test.unimicro.no/api/biz/orders?select=CustomerName,Status,SalesPerson

Examples

Example of filter, expand and select

GET https://test.unimicro.no/api/biz/orders?filter=contains(CustomerName,'Wa')&Expand=Customer,Items.Product&select=CustomerName,VatTotalsAmount,Customer.CustomerNumber,Items.ProductId,Items.PriceIncVat,Items.NumberOfItems,Items.Product.Name,Items.Product.Unit

[
    {
        "CustomValues": {},
        "CustomerName": "Warlocks",
        "VatTotalsAmount": 47745000.0000,
        "Deleted": false,
        "ID": 1,
        "CustomerID": 7,
        "Items": [
            {
                "CustomValues": {},
                "ProductID": 10,
                "PriceIncVat": 2125.0000,
                "NumberOfItems": 56000.0000,
                "ID": 1,
                "CustomerOrderID": 1,
                "Product": {
                    "CustomValues": {},
                    "Name": "Wolfsbane",
                    "Unit": "ml",
                    "ID": 10
                }
            },
            {
                "CustomValues": {},
                "ProductID": 9,
                "PriceIncVat": 18750.0000,
                "NumberOfItems": 7800.0000,
                "ID": 2,
                "CustomerOrderID": 1,
                "Product": {
                    "CustomValues": {},
                    "Name": "Tears of Lys",
                    "Unit": "ml",
                    "ID": 9
                }
            }
        ],
        "Customer": {
            "CustomValues": {},
            "CustomerNumber": 100006,
            "ID": 7
        }
    },
    {
        "CustomValues": {},
        "CustomerName": "Nights Watch",
        "VatTotalsAmount": 25125000.0000,
        "Deleted": false,
        "ID": 2,
        "CustomerID": 2,
        "Items": [
            {
                "CustomValues": {},
                "ProductID": 4,
                "PriceIncVat": 550000.0000,
                "NumberOfItems": 150.0000,
                "ID": 3,
                "CustomerOrderID": 2,
                "Product": {
                    "CustomValues": {},
                    "Name": "Obsidian Dagger",
                    "Unit": "stk",
                    "ID": 4
                }
            },
            {
                "CustomValues": {},
                "ProductID": 5,
                "PriceIncVat": 837500.0000,
                "NumberOfItems": 150.0000,
                "ID": 4,
                "CustomerOrderID": 2,
                "Product": {
                    "CustomValues": {},
                    "Name": "Obsidian Spear",
                    "Unit": "stk",
                    "ID": 5
                }
            }
        ],
        "Customer": {
            "CustomValues": {},
            "CustomerNumber": 100001,
            "ID": 2
        }
    }
]