Fetch Car Models by Manufacturer, Category, and Year data from your Java app
Follow this guide to fetch Car Models by Manufacturer, Category, and Year data from your Java app. The HttpURLConnection library will be used to fetch the database data through its REST API.
Step 1 - Connect your app
First you need to connect your app to the Car Models by Manufacturer, Category, and Year database. It will authorize you to access this database API using your app keys. If your app doesn't have keys at Back4App yet, they will be generated during this process.
If your app is already connected to this database, you don't need to do this process again. Just select your app from the list below.
For your convenience, you can also use a fake app (test purposes only) and leave this step to be done later.
Which app do you want to use?
Step 2 - Customize your query
Now let's customize your query to fetch the data that you need!
Which class do you want to fetch data from?
Step 3 - Get your code
In this guide we will use the org.json library to parse the returned data into a JSONObject. Make sure that you have this library's jar file imported to your project's referenced libraries.
Add the following code to your Java app:
After running the app, you should see the following output in your app logs: