Blog

Milestone change is coming - Web API in GrandNode 4.40

Friday, January 18, 2019 Comments (1)

GrandNode 4.40 version is coming. As always we prepared many important features for you. We will start to discover them before official beta release. As a first and probably the most important feature - Web API OData. We decided to implement the OData Web API out of the box for free. We know that for each developer, Web API is a fantastic tool and it can be used in any kind of online store. Let's learn some basics about OData API. 

REST should be used if it is very important for you to minimize the coupling between client and server components in a distributed application. REST web services are resources on the web that can be used to get specific information.

What it means for you as GrandNode store administrator? It’s simple, Web API gives you access to business data stored in GrandNode database. Please note that using Web API feature requires at least basic knowledge about the GrandNode database structure.

In e-commerce each user want fast and optimized applications. In e-commerce each user also leave vast amount of data in your stores. Data which can’t be used is useless, it can be used only when applications and people can access to them. Probably you are wondering how you can access to it? With rescue comes Open Data Protocol, commonly called OData, this protocol is used in our Web API plugin. Goal of this article is to illustrate why OData is the best and why you should use it in your GrandNode store.

Let’s start with explanation how OData works. OData has four main parts:

OData data model – it’s server side model, it generaly means that all data is available on server and client only knows currently requested data. For example specified operations like filtering or sorting are done on the server. In simplification client sends a filtering or sorting request to the server and server shows the returned data.

OData uses the Entity Data Model (shorter version EDM). 

OData protocol – it lets a client make requests to and get responses from an OData Service, which will be desribed later. It’s based on common web protocols like HTTP and Atom by adding the ability to execute queries and return subsets of data in XML or JSON formats.

OData client libraries – simply enable you to quickly and easily create software that accesses data via the OData protocol.

In our plugin we use ASP.NET Web API OData v4 library. According to OData documentation:
„ASP.NET Web API Odata is a framework that makes it easy to build OData services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API OData is an ideal platform for building OData applications on the .NET Framework.”

 - OData service – Basic OData services consist just a feed. If you create more refined services they could have several feeds. It’s important to create document that will list all feeds so client can easily disover them.

Supporting OData Query Options in ASP.NET Web API 2

OData defines parameters that can be used to modify an OData query. The client sends these parameters in the query string of the request URI. For example, to sort the results, a client uses the $orderby parameter:

https://yourstore.com/odata/Product?$orderby=Name

The OData specification calls these parameters query options. You can enable OData query options for any Web API controller in your project — the controller does not need to be an OData endpoint. This gives you a convenient way to add features such as filtering and sorting to any Web API application.

OData Query Options

Web API Plugin supports the following OData query options:

Option

Description

$filter

Filters the results, based on a Boolean condition.

$orderby

Sorts the results.

$skip

Skips the first n results.

$top

Returns only the first n the results.

 

GrandNode Web API

More details about implemented API can be found in our documentation page, which can be found here: 

http://docs.grandnode.com/web-api

Inside you will find very useful information, for example:

- how to generate authorization token,

- how to create Web API user,

- how to create a new product,

- how to create a new customer.

and many, many more. 

Leave your comment

avatar

This will be a welcome addition for integration with our current on-site inventory management and point of sale system.