Skip to main content

Test OData 4.0 Service

· 3 min read
Ravi Kant Sharma

Browse OData 4.0 Service Using OData Client Node or Postman Client.

Hey there folks!
You must be here for a reason, We know you have created an OData Service with IgniteConnex and now you can't wait to see it in action. well, if you haven't created one yet, learn how to create an OData Service here.

Well, fasten you seat-belts because now we are going to get a live tour of our service. You can either use OData Client node or Postman Client to access your APIs as per your convenience. There will be no changes in the requests no matter which client you use. We will be Postman Client for this tutorial. Open Postman on your system and lets get started.

For this example we will take a table (entity) Users with columns (properties) (ID, FullName, Username) and perform CRUD operations on that table using our OData service. To perform CRUD operations, let's start with a GET call.

note

Replace ServiceRoot with your Service URL in the below example URLs.

Requesting Data

Entity Collections

The call below will fetch us data from Users table.

GET serviceRoot/Users

Individual Entity

The call below call will fetch us data from Users table with specified key(primary key).

GET serviceRoot/Users(1)

Specific Fields

The call below will fetch FullName property from Users table with specified key(primary key).

GET serviceRoot/Users(1)/FullName

Querying Data

$top

The call below will fetch top 5 records.

GET serviceRoot/Users?$top=5

$skip

The call below will skip top 5 records.

GET serviceRoot/Users?$skip=5

$select

The call below will get us FullName and Username for all records.

GET serviceRoot/Users?$select=FullName, Username

$count

The call below will get us all the matching records with @Odata.count property with record count.

GET serviceRoot/Users?$count=true

$orderby

The call below will fetch us all records in ascending order

GET serviceRoot/Users?$orderby= Id

  • $orderby= Id asc (default)
  • $orderby= Id desc

$filter

The call below will fetch records where the filter matches the specified criteria.

GET serviceRoot/Users?$filter=FullName eq 'Ravi'

you can add multiple filters by separating them with 'AND' & 'OR' keywords.

  • Fullname eq 'Ravi' AND Username eq 'Ravi-Kaushish'
  • Fullname eq 'Ravi' OR Username eq 'Ravi-Kaushish'
note

New version of OData Nodes support filter function, will be added here soon

Data Modification

Create a Record

The request below will create a new resource in Users table.

POST serviceRoot/Users

{
"Id": 8,
"FullName": "Ravi Sharma",
"Username": "Ravi-Kaushish"
}
info

Request body must contain the data to POST.

Delete a Record

The call below will delete the record with Id 6 from Users table.

DELETE serviceRoot/Users(6)

danger

The primary key for the matching record must be provided.

Update a Record

PATCH serviceRoot/Users(8)

{
"FullName": "Bijay",
"Username": "Bijay-Shah"
}
caution

The request body must only contain the data that you want to UPDATE.

These are the features our OData Nodes supports in its early version.

While you keep doing magic with our tools, we are here working hard to make things even better for you. Fist Bump