Question Details

No question body available.

Tags

python api-design django

Answers (1)

August 18, 2025 Score: 0 Rep: 9 Quality: Low Completeness: 100%

Note: I am basing my answer on the assumption that "Django + Angular" means "Angular front-end with Django back-end".

If you haven't already, I would look into Django REST Framework. This is by far the easiest way to create custom APIs with Django.

Now, from what you describe, you should really only need one Django app. Let me break this problem down into two parts: (1) handling the growing number of external APIs being used; and (2) using the external APIs to return the necessary data to the user.

Part 1: Addressing the Scaling Issue

One of the best parts about Django is that you can manage data very easily with it. I would start by creating a database specifically for this application and connecting it to your Django project.

From here, you should create a model, that is meant to represent an individual external API, in the models.py file. You'll likely have 3 fields in this model, one for each of the 3 endpoints that you have given us as an example. You can also add other fields if you would like (maybe a "name" field for readability?). After the model is created to your liking, add this model to the admin page (admin.py).

Upon completion of the above, run the Django server. It may ask you to run migrations, which the output goes into further detail on how to do so. Once the server is running, navigate to "/admin" on the server URL. It will prompt you to log in to your account (assuming that you've created one already). After logging in, you should see the model that you created earlier. From here, you can begin to add all of your external APIs.

Part 2: Getting the Data

With the proper data structure in place, you are now ready to use the data that you've stored. As mentioned before, you'll want to use the Django REST Framework.

In views.py, you will create all of the endpoints that you will need for the application, including:

  • A GET request for all of the external APIs you have available, which should return the data for each of those APIs, including its unique ID.
  • A GET request for each of the views that you mentioned before
    • Instead of manually-entered URLs, you will use the new model to grab the correct URL from the database based on a given ID (the documentation on models that I linked before tells you how to do this)
    • After getting the proper URL, you will call that API as normal and return the data that you receive.

Once the views have been created, go into urls.py and create URLs for each endpoint. The most important part of this is being able request data based on an external API's unique ID, as that allows us to keep the API isolated to a single app. Make sure that each of the views you have created can accept this unique ID so that it can return the correct data.

With everything in place, you should be able to navigate to whatever URL you would like in the browser (thanks to Django REST Framework), and if successful, it will show you the data that you need.