Rio2016 Medal Standings (Part1): Using MCS internal Database
In this 3-part post series I will show how to build an Oracle MAX Application that will display the medal standing in Rio 2016.
This is what we are going to do in order to achieve our goal.
First we are going to use Oracle MCS internal database to store the urls of the flags that we will display in the application and we will also create a custom API to retrieve the records from the database.
Let’s start! The node module that we are going to use to retrieve the standings doesn’t give us the flags url so we need to get them.
At this moment we can display either static or remote images in Oracle MAX, but the source of the image has to be its absolute url, we cannot display images from MCS Storage. This would be a great feature to have.
I stored in a server lots of flags, but we need to know what url corresponds to each country and we will use MCS Database to do it.
- /load (POST method): we will use this to load the data intro the database.
- /countries: Returns all the countries.
- /countries/{id}: Returns one country.
{“ESP”: “http://mydomain/Spain.png”, “GER”, “http://mydomain/Germany.png“}
We will only use /countries endpoint but wanted to show more than one operation that can be done with Database Platform API. You can check more operations like delete or merge in this link: Accessing the Database Access API from Custom Code
We have finished the implementation. In implementation tab we have to upload the .zip file into MCS.
Now it is time to test everything.
After executing the load operation we ar ready to test the two GET operations.
The first one, providing an id that does not exists, returns unknown flag values.