Skip to content

Milestone 2 Bahri Alabey Individual Report

Bahri Alabey edited this page May 12, 2023 · 1 revision

Individual Contribution Report (Bahri Alabey)

Issues Related to the Practice Application

  • #132: Described the functionality I'm going to implement.
  • #165: Described what to write on this report and what to explain.

External API

The GeoDB cities API is used. The API offers a straightforward RESTful interface, allowing users to make HTTP requests and receive JSON responses containing details about the cities, population, currency and etc. But I'll not use all of the response data, only country, population and city name will be used.

Following url has the details about the API, it may request an account. https://rapidapi.com/wirefreethought/api/geodb-cities , can check the link for further explanations about the API and docs.

API Functions

I have created 2 functions for my internal API. One is for getting all the favourite cities and the other is to make a city favourite. API Functions

  • createCity - POST: This endpoint allows users to add a city to their favorites list by sending a request containing the necessary information. Upon successful addition, the endpoint responds with success code 200 and a string "City created successfully!". If an error occurred, it responds with error code and a string "Failed to create city".

  • getAllCities - GET: This endpoint allows users to get their favourite cities list. Upon successful request, it returns an array of the cities that added as favourite by user.

Sample Calls

In order to get cities with filter, I've sent a POST request to Geo DB API. Here is one example request response. Get Cities Response

Also some parameters must be sent in the header and the body of the request. First, the key must be sent in the header since API is requiring account.

Since filters are not mandatory, all of the body parameters are optional. I've used 4 of them (minPopulation, maxPopulation, namePrefix, limit). But there are lots of parameters that can be used. I've sent those in the body. Here is my request to get cities with filter. axios request

Challenges

I had some problems about the time. Also understanding what we need to do was harder than actually doing it.

bounswe2023group8

🏠 Home

🗄️ Project
Milestones
👤 Individual Contribution Reports
Milestone 1
Milestone 2
Final Milestone
🖇️ Lab Reports
📑 Templates
👥 Team Members
CmpE 352
Old Project Files
📅 Meetings
🔬 Researches
👤 Individual Contribution Reports
Clone this wiki locally