Demo Application

Let's explore the use of the GitHub REST API with the help of a Django application.

Introduction

We’ll use Django, a Python framework, to implement an application that uses the GitHub REST API. We’ve implemented some of the endpoints used in this course to perform operations on repositories, projects, and search features. 

Workflow

We have our demo application in the widget below. The main logic of the application and the GitHub APIs are written in the views.py file. The APIs that we used in the application and their relevant lines of code are listed below:

  • Branches
    • List branches (lines 85–97).
  • Commits
    • List commits (lines 99–111).
  • Collaborators
    • List collaborators (lines 113–125).
  • Projects
    • Create a repository project (lines 127–138).
    • List repository projects (lines 140–154).
    • Create a user project (lines 156–167).
    • List user projects (lines 69–83).
  • Repositories
    • Create a repository (lines 31–42).
    • Update a repository (lines 44–55).
    • Delete a repository (lines 57–67).
    • List repositories (lines 69–82).
  • Search
    • Search repositories (lines 17–29).

Run the application

The demo application can be run by clicking the “Run” button in the widget below. The application can be viewed by clicking the link given against "Your app can be found at:" at the bottom of the widget.

Note: The following widget only shows the necessary files required to run the application on our platform.

Get hands-on with 1200+ tech skills courses.