Complete the form below to request a free gap analysis:
AuraQ has vast experience helping organisations find the gaps that can be filled to enhance their business. This could be to improve efficiency, integrate legacy systems or deliver new portals and strategic applications to create competitive advantage. Contact us to request a free, no obligation Gap Analysis.
A guide to OData (Exposing and Consuming an OData Feed using Mendix)
First of all, what is OData? Well, the official OData website says it best:
“OData (Open Data Protocol) is an ISO/IEC approved, OASIS standard that defines a set of best practices for building and consuming RESTful APIs. “
What’s it used for? OData is perfect for retrieving data from multiple data sources quickly and easily. It is very common in Business Intelligence (BI) tools, most popular BI tools allow you to connect to a OData feed directly and with ease, examples include:
Microsoft Power BI
Tableau
SAP Data Services
Even Excel provides an easy way to connect to an OData feed which we will look in to later, for now let’s get started on creating an OData source using Mendix.
Start by creating a new app in the Mendix Modeler. Conveniently Mendix provide starter apps which are perfect for this, so I’m going to use the asset manager starter, however there is nothing stopping you from following this tutorial using your own already built app(s).
Start by right clicking MyFirstModule and adding a new folder called OData Services. Your project explorer should look like this:
Right click the new folder and select ‘Add Published Services Published OData Service’. Give the service a name -I named mine ‘Assets’- and click okay on the configuration window that appears afterwards (we shall configure that later). Now open the domain model.
Next open the data model for your app. It’s here where we can choose what data you want to expose as an OData feed; right click the assets entity and select ‘Expose as OData resource’ then select our published OData service that we created earlier
You should now be able to name the exposed entity and select which attributes you want to expose by clicking the ‘Select’ button, I named mine ‘GetAssets’
Now you can simply check or uncheck the attributes you want to expose via the OData feed as well as change the name that is exposed. When you’re done click ‘OK’ and ‘OK’ on the previous window, you should now have this window:
We can at this point test our OData feed, but before that let’s take a look at the settings tab:
We can specify a namespace for the service and also see where our Service feed is located, as well as the metadata file that Mendix generates. Lastly, there is the security options where you can select an already created role and lock down the feed to a particular user or group of users, this is incredibly important in production systems and must be configured before going live.
Now let’s test our newly created OData feed! Click the ‘OK’ button and deploy your app locally. Wait for Mendix to finish processing then navigate to the URL specified in the settings of the published OData feed. If all is well you should get an XML document that lists all the resources you created (I only have one: ‘GetAssets’) if you type that after the last forward slash in the URL bar you should get an XML document with all the data. The URL should look something like this if you have followed the tutorial:
http://localhost:8080/odata/Assets/GetAssets
If you have data in XML form, then congratulations! You have successfully created an OData service using Mendix. If you get an error, then go back and re follow the steps to try and find the problem.
Using Excel to Consume the Feed The XML document is great, but it’s not particularly easy to read. We can use Excel to quickly consume the service and display the data in a much more appealing format. Start by opening a new blank Excel document then selecting the Data tab on the ribbon, from there select ‘Get Data’ ‘From Other Source’ ‘From OData Feed’
Enter the URL to our GetAssets OData feed and click OK:
You should get a preview of the returned data and an option to edit but for simplicity’s sake just click ‘Load’. Excel should now load the entire data set and present the information to you:
Any number fields will appear as scientific notation by default, but the column can easily be reformatted to numbers. The data can be filtered down and queried using URL parameters, Mendix has very good documentation on doing this:
This is a very basic example of exposing and consuming an OData feed, but it does show how quickly they can be set up particularly if using a low code platform like Mendix or K2. Combining this with the wide support for OData from reporting tools, rich reporting on systems can be achieved very quickly and easily meaning less time and money is spent on development of these features.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.