Start interactive tutorial

← Back to Projects

Queue Managment API

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

🌱 How to start this project

Let's create a Queue System: Queue systems are heavily used in Government institutions, airports, banks, and many other venues looking to organize the incoming traffic.

Queue systems can also be used to load balancing for different applications like:

  • Establishing priorities in web servers' incoming requests.
  • Immigration and visa applications that need to be prioritized.
  • Network packages.
  • etc.

🌱 How to start this project

Do not clone this repository.

The first step to start coding is cloning the python boilerplate on your local computer or opening it using gitpod.

b) If working locally, type the following command from your command line:

1https://github.com/4GeeksAcademy/flask-rest-hello`

💡 Important: Remember to create a new repository, update the remote (git remote set-url origin <your new url>), and upload the code to your new repository using add, commit and push.

📝 Instructions

  • The API has to integrate with Twillio API to be able to send SMS to notify users when their turn has arrived.

  • Create an API that allows clients to manage a simple Queue, and use the following data structure to implement the queue:

1class Queue: 2 3 def __init__(self): 4 self._queue = [] 5 # depending on the _mode, the queue has to behave like a FIFO or LIFO 6 self._mode = 'FIFO' 7 8 def enqueue(self, item): 9 def dequeue(self): 10 def get_queue(self): 11 def size(self): 12 return len(self._queue)

Example workflow

  1. The API receives a request to add Bob into the queue (POST /new) with any particular priority (FIFO or LIFO).
  2. The API ads Bob and notifies him with an SMS confirmation, the SMS must say how many people are in front of him on the line.
  3. The system now waits until the enpoint GET /next gets executed to process the person on the queue.
  4. Every time a GET /next request is received, the next person on the queue gets processed until it is Bob's turn.
  5. When Bob is processed, the system sends him another SMS to let him know that his turn has arrived and deletes him from the list.

More details

  1. You have to create 3 endpoints for your API:
  • POST /new: Will receive information about a user and add him to the queue.
  • GET /next: Will process one spot of the queue.
  • GET /all: Will return a list with everyone that is pending to be processed (the current queue).

📖 Fundamentals

This exercise will make you practice the following fundamentals:

  1. Here you can find the information on how to send a sms with twillio, you will have to register an account (free) and also register a number (free)
  2. Building a RESTful API
  3. Complex Data Structures.
  4. Queue (FIFO vs FILO)
  5. SMS.

Signup and get access to this project for free

We will use it to give you access to your account.
Already have an account? Login here.

By signing up, you agree to the Terms and conditions and Privacy policy.

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Signup and get access to this project for free

We will use it to give you access to your account.
Already have an account? Login here.

By signing up, you agree to the Terms and conditions and Privacy policy.

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Difficulty

  • intermediate

Average duration

8 hrs

Technologies