Skip to content

Instantly share code, notes, and snippets.

@kylehg
Created September 25, 2013 01:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylehg/6694145 to your computer and use it in GitHub Desktop.
Save kylehg/6694145 to your computer and use it in GitHub Desktop.
PCR API refactor spec

PCR API Refactor Spec

Author: Kyle Hardgrave (kyleh@seas)

This is a spec for how I'm going to refactor the PCR API, both internally and externally.

Goals

  • Make the API routing and controller code more fitting with Django standards
  • Make the external API simpler, more RESTful, and more useful

Non-Goals

  • Adding functionality to the API
  • Changing model representation

Code reorg

  • Much of views will likely be rewritten

New API Format

Endpoints

/course/:dept/:course_num

{
    latest_description: '...',
    aliases: [
        'CIS-140',
        'LING-140',
        'PSYC-140',
        'COGS-001'
    ],
    // ... other course-general info, non-semester-specific
    reviews: [
        // ... review.toJson()
    ]
}

/course/:dept

A list of the above, paginated and sorted by ascending course number

/department/:dept

{
    name: 'History',
    code: 'HIST',
    courses: [
        //... course.toShortJson()
    ]
}

/instructor/:instructor_id

{
    first_name: 'James',
    last_name: 'Bond',
    pennkey: '',
    courses: [
        //... course.toShortJson()
    ]
    reviews: [
        //...review.toJson()
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment