A couple of colleagues and I decided to join ODTUG’s APEX Gaming Competition. The first challenge was to come up with a great idea for an addictive game. We had some creative people sitting around the table and after some brainstorming we ended up with a simple yet interesting concept: a movie guessing game based on a movie database web API.
Now, when you read “movie database”, the first thing you probably think of is IMDb. It came as a surprise to me that they don’t publish an (official) API. IMDb only distributes plain text data files, and that’s not really what we were looking for. In our search for an alternative, we came across TMDb (https://www.themoviedb.org/). It perfectly fitted our needs: an extensive movie database, well documented and reliable.

Before starting development, we had one important question to answer: “Do we invoke the TMDb web API from client or server side?”. The easy solution would have been to pick the client side. Calling a couple of web services in JavaScript (or jQuery) and storing their JSON result into a variable is pretty straightforward. However, this would mean that all movie information would just linger around in the browser. You would literally see the movie title passing by when keeping an eye on the incoming TMDd AJAX responses. This idea bothered us too much and made us choose to invoke the TMDb web services from server side. Each hint requested by the end user would then result in a separate AJAX call returning only the requested information.
Invoking the web services from PL/SQL also gave us the opportunity to play around with the new APEX_JSON package, which has been introduced in APEX 5.0. After getting familiar with the package, it was pretty easy to parse the TMDb JSON responses and collect all relevant movie information. Take a look at the MG_TMDB_API_PKG if you want some example code on how to use the APEX_JSON package.
Here are some useful links related to this blog post:
- Play MoviePick
- The source code is hosted on GitHub
- Sponsored by Contribute
- Other entries for ODTUG’s APEX Gaming Competition
Cool game. How are you hiding your APEX URL? I noticed that the whole time, it just says /moviepick/ without the whole f?p=X:Y:Z…
LikeLike
The APEX application is embedded as an iFrame in a regular HTML page. /moviepick/ is the parent window’s URL.
LikeLike
Lots of fun! Can I make a suggestion – it’s unfair to penalize “BEN HUR” when the “correct” answer is “BEN-HUR” – it should accept spaces and dashes interchangeably. :)
LikeLike
Gah! another one – entered “SEVEN”, correct answer was “SE7EN”, then it shows the movie poster which quite clearly shows “SEVEN” !! :(
LikeLike
And another: correct answer “ACE VENTURA: PET DETECTIVE” (i.e. the second word was shown as having 8 characters including the “:”). I think you need to normalize the titles :)
LikeLike
Hey Jeffrey,
We are aware of the fact that some movie titles are difficult to guess correctly. And indeed, a couple of movie titles can be written in different ways. In version 1.1 of the game, we’ll automatically show special characters in movie titles. That will make it easier to write down the expected answer.
Thanks for your feedback,
Nick
LikeLike
Hi! I have question about APEX Select List.
APEX 4.2. I need Select List with functionality: both Empno and Ename displayed when Select List opened, only Ename displayed when it collapsed and always Empno returned.
Have you some ideas?
LikeLike
Hello,
I’m afraid that’s not entirely possible. The value shown when the select list is collapsed is always the LOV’s display value. You can’t change the display value based on the state of the select list. The best alternative is to use the EMPNO and ENAME in the display value, and the EMPNO as return value.
Nick
LikeLike
Really enjoyed this. Great stuff.
LikeLike