OData in Our API
OData (Open Data Protocol) is a standardized way to query and manipulate data over RESTful APIs. It enables flexible and powerful data access using URL parameters, making it easier to filter, sort, and shape the data you need.
How We Use OData
Our API supports OData query options to give you full control over the data returned. Here are the key parameters you can use:
$select – Choose specific fields to return, reducing payload size.
$filter – Apply conditions to retrieve only the data you need.
$skip – Skip a defined number of records, useful for pagination.
$top – Limit the number of records returned.
$count – Include the total count of matching records in the response.
$orderby – Sort results by one or more fields.
$expand – Include related entities in the same query for richer data.
Example Request
GET https://api.tidsbanken.net/timelinje/TimelinjeBehandlet?$select=id,ansattid,dato,antallTimer &$filter=avdelingId eq '1' &$count=true &$orderby=ansattid &$expand=Ansatt($select=fornavn,etternavn,eksternId)
Explanation:
$select: Returns only the fields
id,ansattid,dato, andantallTimer.$filter: Filters records where
avdelingIdequals1.$count=true: Includes the total number of matching records in the response.
$orderby: Sorts results by
ansattid.$expand: Retrieves related data from the
Ansattentity and includesfornavn,etternavn, andeksternId.