eCommerce 2 API Tutorial Series

eCommerce 2 API is a step-by-step guide to implementing an RESTful API into your eCommerce 2 project using the Django Rest Framework, Django Rest Framework JWT, Django CORS Headers, and more.

The project we use is eCommerce 2. Created by Team CFE @ http://joincfe.com.

Project Overview

  1. Implement a RESTful API (wikipedia) to a pre-existing eCommerce project made in Django. (Souce Code | Video Series)

  2. Products & Categories

    • Create Serializers and API Views
    • Product variations API (pricing + name)
    • Implement product photos
  3. Querying & Filtering

    • Create a Search Function for the API
    • Enable a Django Filter for further filtering of Search Results (or List Results)
  4. User Specific

    • Cart, Checkout, & finalizing Orders
    • JWT (JSON Web Token) Authentication
    • View User-only Orders
  5. Required Packages

    • Everything in src/requirements.txt of the eCommerce 2 project
    • Django Rest Framework (for API)
    • Django Rest Framework JWT (for Auth)
    • Django CORS Headers (for cross-origin HTTP requests)

API Guide

Interested in learning more?

Sign up on our YouTube channel

Become a member on Coding for Entrepreneurs

The tutorial code below is the final code from the end of each tutorial video. Each link below is tied directly to the tutorial's title. Please note that some videos will not have code reference code.

Tutorial Code

5 - Pip Intallations

6 - Model Serializers

7 - API List View

8 - API Retrieve View & URL

9 - Product & Variation Serializers

10 - Product List & Retrieve View

11 - Update & Create in the API

12 - Permissions

13 - Authentication

14 - Pagination

15 - Filtering the API

16 - Using a Base API View

17 - User Checkout Part 1

18 - User Checkout Part 2

19 - User Checkout Part 3

20 - Auth with JWT Tokens

21 - Testing JWT Tokens with Python Requests

22 - JWT Token Refresh

23 - Cart API View

24 - Cart Token

25 - Update Cart in API

26 - Testing Cart API with Python Requests

27 - Display Cart Items

28 - Token Mixin

29 - Checkout API View Part 1

30 - CartToken Mixin

31 - Refactor Cart API View

32 - Checkout API View Part 2

33 - Order Serializer

34 - Add User to Checkout

35 - User Address Create & List

36 - Checkout API View Part 3

37 - Checkout API View Part 4

38 - Custom Serializer for Checkout

39 - Serializer Validation

40 - API Test Function

41 - Order from Validated Data

42 - Finalize Order Serializer

43 - Finalize Order API View

44 - Get Client Token

API Test Index.html

45 - Payment Transactions

46 - Django CORS Headers.mp4

47 - Order List & Retrieve

49 - Final Edits

50 - Final Code