# OData Basics

### What is OData?

> *"An **open protocol** to allow the creation and consumption of **queryable** and **interoperable RESTful APIs** in a **simple** and **standard** way" - odata.org*

OData is short for Open Data Protocol. It's an standardized protocol which allows the creation and consumption of RESTful APIs. RESTful services is a well know and established interface concept throughout the modern internet. The most common protocol used for REST services is HTTP and the URI in a RESTful services should refer to a resource combined with a HTTP method, GET, POST, PATCH etc. Request and payloads is most commonly formatted as JSON but XML and other formats is also possible.&#x20;

{% hint style="info" %}
OData extends on the RESTful concepts with standards like: request and payload headers ,URL conventions, payload formats, query keywords etc.&#x20;
{% endhint %}

### OData examples

The below examples is from the tutorial you will find in the next section.

#### GET request examples

{% hint style="info" %}
By clicking the URLs below your browser will perform a HTTP GET requests. The response will be a JSON.
{% endhint %}

* GET the resource **People** the URL would look like: <https://services.odata.org/v4/TripPinServiceRW/People>
* GET and **individual resource** of the entity **People** the URL would look like: <https://services.odata.org/v4/TripPinServiceRW/People('russellwhyte')>
* Query for **People** with certain conditions and **$top**,**$select** and **$filter** parameters: [https://services.odata.org/v4/(S(i1jaylafcdysy0xtxlukhcqw))/TripPinServiceRW/People?**$top**=2%20\&amp;%2&#x30;**$select**=FirstName,%20LastName%20\&amp;%2&#x30;**$filter**=Trips/any(d:d/Budget%20gt%203000)](https://services.odata.org/v4/\(S\(i1jaylafcdysy0xtxlukhcqw\)\)/TripPinServiceRW/People?$top=2%20\&amp;%20$select=FirstName,%20LastName%20\&amp;%20$filter=Trips/any\(d:d/Budget%20gt%203000\))

#### POST example

```url
POST https://services.odata.org/v4/(S(34wtn2c0hkuk5ekg0pjr513b))/TripPinServiceRW/People HTTP/1.1
OData-Version: 4.0
OData-MaxVersion: 4.0
Content-Length: 428
Content-Type: application/json
{
    'UserName':'lewisblack',
    'FirstName':'Lewis',
    'LastName':'Black',
    'Emails':[
        'lewisblack@example.com'
    ],
    'AddressInfo':[
        {
            Address: '187 Suffolk Ln.',
            City: {
CountryRegion: 'United States',
Name: 'Boise',
Region: 'ID'
            }
        }
    ],
    'Gender': 'Male',
    'Concurrency':635519729375200400
}
```

### OData tutorials

A good and comprehensive way to quickly learn basics of OData is to go through the tutorials provided by odata.org. You should go through the "For absolute beginners" and "Basic tutorial". &#x20;

When using the Novacura OData Connector you will interact with the OData services in a "No code"-manner by abstracting away the complexity of OData. But having OData knowledge will ease IFS debugging and overall understanding; ultimately making you a better developer. Follow the link below.

{% embed url="<https://www.odata.org/getting-started/>" %}
Click the link to go to tutorials
{% endembed %}

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2F66GkjrDxSNKt0ygxhGig%2FdGKuEkBs5Q.png?alt=media&#x26;token=79ebf6b6-0ce0-4a63-bbed-557bb1658a4e" alt=""><figcaption><p>Tutorials at odata.org</p></figcaption></figure>
