OData V4.0
OData is a data access protocol built on core protocols like HTTP and commonly accepted methodologies like REST API for the web. Version 4 is suited for building inherently consistent REST APIs.
The OData V4 connector supports GET requests for requesting data.
POST, PATCH, PUT and DELETE requests are also supported for some exposed entities.
A sample OData Service that you can use can be found by using the following URL: https://services.odata.org/V4/OData/OData.svc
This has multiple collections that you can connect to such as Products, Suppliers and Advertisements.
{
"@odata.context": "https://services.odata.org/V4/OData/OData.svc/$metadata",
"value": [
{
"name": "Products",
"kind": "EntitySet",
"url": "Products"
},
{
"name": "ProductDetails",
"kind": "EntitySet",
"url": "ProductDetails"
},
{
"name": "Categories",
"kind": "EntitySet",
"url": "Categories"
},
{
"name": "Suppliers",
"kind": "EntitySet",
"url": "Suppliers"
},
{
"name": "Persons",
"kind": "EntitySet",
"url": "Persons"
},
{
"name": "PersonDetails",
"kind": "EntitySet",
"url": "PersonDetails"
},
{
"name": "Advertisements",
"kind": "EntitySet",
"url": "Advertisements"
}
]
}
Download a ODataV4 Demo Project
Connection
To connect to a OData 4.0 Service start by opening the connection window and expanding the OData folder. Then select OData 4.0 Data Source and enter in the Service URL, any required credentials, and then choose an entity to connect to.
To finish click Connect & Create Library Connection to save the connection to the connection library so that you can use it again in future projects.
Authentication Options
The connector supports two types of authentication: OAuth2 Authentication and Windows Authentication if your service requires authentication.
We have a specific guide available for help on using OAuth to connect via GraphAPI with the OData connector:
Windows
To enter your Windows credentials, click onto the ellipsis (...
) to open the credentials window.
OAuth2
To enter the OAuth2 connection details, click onto the ellipsis (...
) to open the connection properties window.
The table below has a brief description of each field to help you configure the authentication correctly.
Field | Value |
---|---|
Authorise URL | URL to get authorisation from the service. |
Token URL | Where the service can make a request to get an access token for a user e.g.Azure Token Endpoint URL |
Client ID | A publicly exposed string that is used by the service API to identify the application |
Client Secret | Used to authenticate the identity of the application to the service API, this must be kept private between the application and the API |
Resource | The resource server that hosts the user account |
Redirect URL | Where the service will redirect the user after they authorize (or deny) the application. You can set this to wherever you prefer or you can use the Simego default |
State | Preserves some state object set by the client in the Authorization request and makes it available to the client in the response. |
Scope | Can be used to selectively enable access to a user’s account based on the functionality needed |
Grant Type | Authorisation Code - optimized for server side applications where source code is not publicly exposed. Implicit - used for mobile apps and web applications where the client secret confidentiality is not guaranteed. Client Credentials - provides an application a way to access its own service account. Resource Owner Password Credentials - user provides service credentials (username and password) directly to the application, these are then used to obtain an access token from the service. |
Updating the Connection
If you have saved the connection to the connection library and want to make any changes to your OData connection you will need to delete the cache file to update the connection in Data Sync. To do this open the Tools menu and select Open Schema Cache Folder. You then need to delete the cache file for your connection.
You can now edit the connection by going to the connection library and right clicking onto the connection you want to edit. Select Properties to open the connection view and make any of the changes you need to.
The below image shows this for a Navision Connection:
Now when you refresh your connection library the connection will be updated. E.g. New pages added to the Nav API will now show etc.
Connection Properties
Property | Description |
---|---|
Service URL | The OData service URL, this could be the sample OData service https://services.odata.org/V4/OData/OData.svc or specific to the connection you are using e.g. https://graph.microsoft.com/v1.0 for Graph API. |
Entity | The entity in the service to run, this can also be known as OData collections. Choose the entity you wish to connect to from the drop down menu. |
EntityUrlItemConvention | The OData URL Item Navigation Convention. For Dynamics this will be {entity}({key}) . For Azure and other providers this will be {entity}/{key} . |
Timeout | OData service HTTP request timeout. |