openapi: 3.0.2 info: title: Penn Courses API Documentation [Accounts] User [Accounts] User [PCP] Break API version: '' description: ' # Introduction Penn Courses ([GitHub](https://github.com/pennlabs/penn-courses)) is the umbrella categorization for [Penn Labs](https://pennlabs.org/) products designed to help students navigate the course registration process. It currently includes three products, each with their own API documented on this page: Penn Course Alert, Penn Course Plan, and Penn Course Review. See `Penn Labs Notion > Penn Courses` for more details on each of our (currently) three apps. For instructions on how to maintain this documentation while writing code, see the comments in `backend/PennCourses/docs_settings.py` (it is easy, and will be helpful for maintaining Labs knowledge in spite of our high member turnover rate). See our [GitHub](https://github.com/pennlabs/penn-courses) repo for instructions on installation, running in development, and loading in course data for development. Visit the `/admin/doc/` route ([link](/admin/doc/)) for the backend documentation generated by Django (admin account required, which can be made by running `python manage.py createsuperuser` in terminal/CLI). # Unified Penn Courses By virtue of the fact that all Penn Courses products deal with, well, courses, it would make sense for all three products to share the same backend. We realized the necessity of a unified backend when attempting to design a new Django backend for Penn Course Plan. We like to live by the philosophy of keeping it [DRY](https://en.wikipedia.org/wiki/Don''t_repeat_yourself), and PCA and PCP''s data models both need to reference course and section information. We could have simply copied over code (a bad idea) or created a shared reusable Django app (a better idea) for course data, but each app would still need to download copies of the same data. Additionally, this will help us build integrations between our Courses products. # Authentication PCx user authentication is handled by platform''s Penn Labs Accounts Engine. See [Penn Labs Notion > Platform > The Accounts Engine](https://www.notion.so/pennlabs/The-Accounts-Engine-726ccf8875e244f4b8dbf8a8f2c97a87?pvs=4) for extensive documentation and links to repositories for this system. When tags or routes are described as requiring user authentication, they are referring to this system. I highly recommend the [official video course on OAuth2](https://oauth.net/2/) (by Aaron Parecki), then the Platform Notion docs on the "Accounts Engine" for anyone who wants to understand Labs authentication better. Platform is our OAuth2 "Authorization Server", and Django Labs Accounts is an OAuth2 client run by our Django backends (Clubs, Penn Courses, etc), exposing client-facing authentication routes like `penncourseplan.com/accounts/login`. There''s also this Wikipedia page explaining [Shibboleth](https://en.wikipedia.org/wiki/Shibboleth_(software)) (which is used by Penn for authentication, and by the Platform authorization server). See the Django docs for more on Django''s features for [User Authentication](https://docs.djangoproject.com/en/3.0/topics/auth/), which are used by PCX apps, as part of Platform''s accounts system. ' x-logo: url: https://i.imgur.com/tVsRNxJ.png altText: Labs Logo contact: email: contact@pennlabs.org servers: - url: https://penncoursereview.com description: Penn Course Review - url: https://penncourseplan.com description: Penn Course Plan tags: - name: '[PCP] Break' description: '' paths: /api/plan/breaks/: get: operationId: List Breaks description: '(GET `/api/plan/breaks/`) User authentication required.' parameters: [] responses: '200': content: application/json: schema: type: array items: type: object properties: id: type: integer description: The id of the schedule. meetings: type: string readOnly: true description: ' A list of the meetings of this section (each meeting is a continuous span of time during which a section would meet). ' location_string: type: string nullable: true description: ' This represents the location that the user can input themselves. Will use a building object from a drop down or have it validated or something so it can interact with map. Didn''t want to run into issue of users creating arbitrary Room objects, so just using a char field ' maxLength: 80 name: type: string description: ' The user''s name for the break. No two breaks can match in all of the fields `[name, person]` ' maxLength: 255 checked: type: boolean description: ' Whether or not the break has been checked by the user. This is used to determine if the break should be displayed in the user''s schedule. ' meeting_times: type: string description: ' A JSON-stringified list of meeting times of the form `{days code} {start time} - {end time}`, e.g. `["MWF 09:00 AM - 10:00 AM","F 11:00 AM - 12:00 PM","T 05:00 PM - 06:00 PM"]` for PHYS-151-001 (2020A). Each letter of the days code is of the form M, T, W, R, F for each day of the work week, respectively (and multiple days are combined with concatenation). To access the Meeting objects for this section, the related field `meetings` can be used. ' description: '' '403': description: Access denied (missing or improper authentication). tags: - '[PCP] Break' post: operationId: Create Break description: '(POST `/api/plan/breaks/`) User authentication required.' parameters: [] requestBody: content: application/json: schema: type: object properties: id: type: integer description: The id of the schedule. meetings: type: string readOnly: true description: ' A list of the meetings of this section (each meeting is a continuous span of time during which a section would meet). ' location_string: type: string nullable: true description: ' This represents the location that the user can input themselves. Will use a building object from a drop down or have it validated or something so it can interact with map. Didn''t want to run into issue of users creating arbitrary Room objects, so just using a char field ' maxLength: 80 name: type: string description: ' The user''s name for the break. No two breaks can match in all of the fields `[name, person]` ' maxLength: 255 checked: type: boolean description: ' Whether or not the break has been checked by the user. This is used to determine if the break should be displayed in the user''s schedule. ' meeting_times: type: string description: ' A JSON-stringified list of meeting times of the form `{days code} {start time} - {end time}`, e.g. `["MWF 09:00 AM - 10:00 AM","F 11:00 AM - 12:00 PM","T 05:00 PM - 06:00 PM"]` for PHYS-151-001 (2020A). Each letter of the days code is of the form M, T, W, R, F for each day of the work week, respectively (and multiple days are combined with concatenation). To access the Meeting objects for this section, the related field `meetings` can be used. ' required: - name responses: '201': content: application/json: schema: type: object properties: id: type: integer description: The id of the schedule. meetings: type: string readOnly: true description: ' A list of the meetings of this section (each meeting is a continuous span of time during which a section would meet). ' location_string: type: string nullable: true description: ' This represents the location that the user can input themselves. Will use a building object from a drop down or have it validated or something so it can interact with map. Didn''t want to run into issue of users creating arbitrary Room objects, so just using a char field ' maxLength: 80 name: type: string description: ' The user''s name for the break. No two breaks can match in all of the fields `[name, person]` ' maxLength: 255 checked: type: boolean description: ' Whether or not the break has been checked by the user. This is used to determine if the break should be displayed in the user''s schedule. ' meeting_times: type: string description: ' A JSON-stringified list of meeting times of the form `{days code} {start time} - {end time}`, e.g. `["MWF 09:00 AM - 10:00 AM","F 11:00 AM - 12:00 PM","T 05:00 PM - 06:00 PM"]` for PHYS-151-001 (2020A). Each letter of the days code is of the form M, T, W, R, F for each day of the work week, respectively (and multiple days are combined with concatenation). To access the Meeting objects for this section, the related field `meetings` can be used. ' description: '' '403': description: Access denied (missing or improper authentication). tags: - '[PCP] Break' /api/plan/breaks/{id}/: get: operationId: Retrieve Break description: '(GET `/api/plan/breaks/{id}/`) User authentication required.' parameters: - name: id in: path required: true description: '' schema: type: string responses: '200': content: application/json: schema: type: object properties: id: type: integer description: The id of the schedule. meetings: type: string readOnly: true description: ' A list of the meetings of this section (each meeting is a continuous span of time during which a section would meet). ' location_string: type: string nullable: true description: ' This represents the location that the user can input themselves. Will use a building object from a drop down or have it validated or something so it can interact with map. Didn''t want to run into issue of users creating arbitrary Room objects, so just using a char field ' maxLength: 80 name: type: string description: ' The user''s name for the break. No two breaks can match in all of the fields `[name, person]` ' maxLength: 255 checked: type: boolean description: ' Whether or not the break has been checked by the user. This is used to determine if the break should be displayed in the user''s schedule. ' meeting_times: type: string description: ' A JSON-stringified list of meeting times of the form `{days code} {start time} - {end time}`, e.g. `["MWF 09:00 AM - 10:00 AM","F 11:00 AM - 12:00 PM","T 05:00 PM - 06:00 PM"]` for PHYS-151-001 (2020A). Each letter of the days code is of the form M, T, W, R, F for each day of the work week, respectively (and multiple days are combined with concatenation). To access the Meeting objects for this section, the related field `meetings` can be used. ' description: '' '403': description: Access denied (missing or improper authentication). tags: - '[PCP] Break' put: operationId: Update Break description: '(PUT `/api/plan/breaks/{id}/`) User authentication required.' parameters: - name: id in: path required: true description: '' schema: type: string requestBody: content: application/json: schema: type: object properties: id: type: integer description: The id of the schedule. meetings: type: string readOnly: true description: ' A list of the meetings of this section (each meeting is a continuous span of time during which a section would meet). ' location_string: type: string nullable: true description: ' This represents the location that the user can input themselves. Will use a building object from a drop down or have it validated or something so it can interact with map. Didn''t want to run into issue of users creating arbitrary Room objects, so just using a char field ' maxLength: 80 name: type: string description: ' The user''s name for the break. No two breaks can match in all of the fields `[name, person]` ' maxLength: 255 checked: type: boolean description: ' Whether or not the break has been checked by the user. This is used to determine if the break should be displayed in the user''s schedule. ' meeting_times: type: string description: ' A JSON-stringified list of meeting times of the form `{days code} {start time} - {end time}`, e.g. `["MWF 09:00 AM - 10:00 AM","F 11:00 AM - 12:00 PM","T 05:00 PM - 06:00 PM"]` for PHYS-151-001 (2020A). Each letter of the days code is of the form M, T, W, R, F for each day of the work week, respectively (and multiple days are combined with concatenation). To access the Meeting objects for this section, the related field `meetings` can be used. ' required: - name responses: '200': content: application/json: schema: type: object properties: id: type: integer description: The id of the schedule. meetings: type: string readOnly: true description: ' A list of the meetings of this section (each meeting is a continuous span of time during which a section would meet). ' location_string: type: string nullable: true description: ' This represents the location that the user can input themselves. Will use a building object from a drop down or have it validated or something so it can interact with map. Didn''t want to run into issue of users creating arbitrary Room objects, so just using a char field ' maxLength: 80 name: type: string description: ' The user''s name for the break. No two breaks can match in all of the fields `[name, person]` ' maxLength: 255 checked: type: boolean description: ' Whether or not the break has been checked by the user. This is used to determine if the break should be displayed in the user''s schedule. ' meeting_times: type: string description: ' A JSON-stringified list of meeting times of the form `{days code} {start time} - {end time}`, e.g. `["MWF 09:00 AM - 10:00 AM","F 11:00 AM - 12:00 PM","T 05:00 PM - 06:00 PM"]` for PHYS-151-001 (2020A). Each letter of the days code is of the form M, T, W, R, F for each day of the work week, respectively (and multiple days are combined with concatenation). To access the Meeting objects for this section, the related field `meetings` can be used. ' description: '' '403': description: Access denied (missing or improper authentication). tags: - '[PCP] Break' patch: operationId: Partial Update Break description: '(PATCH `/api/plan/breaks/{id}/`) User authentication required.' parameters: - name: id in: path required: true description: '' schema: type: string requestBody: content: application/json: schema: type: object properties: id: type: integer description: The id of the schedule. meetings: type: string readOnly: true description: ' A list of the meetings of this section (each meeting is a continuous span of time during which a section would meet). ' location_string: type: string nullable: true description: ' This represents the location that the user can input themselves. Will use a building object from a drop down or have it validated or something so it can interact with map. Didn''t want to run into issue of users creating arbitrary Room objects, so just using a char field ' maxLength: 80 name: type: string description: ' The user''s name for the break. No two breaks can match in all of the fields `[name, person]` ' maxLength: 255 checked: type: boolean description: ' Whether or not the break has been checked by the user. This is used to determine if the break should be displayed in the user''s schedule. ' meeting_times: type: string description: ' A JSON-stringified list of meeting times of the form `{days code} {start time} - {end time}`, e.g. `["MWF 09:00 AM - 10:00 AM","F 11:00 AM - 12:00 PM","T 05:00 PM - 06:00 PM"]` for PHYS-151-001 (2020A). Each letter of the days code is of the form M, T, W, R, F for each day of the work week, respectively (and multiple days are combined with concatenation). To access the Meeting objects for this section, the related field `meetings` can be used. ' required: - name responses: '200': content: application/json: schema: type: object properties: id: type: integer description: The id of the schedule. meetings: type: string readOnly: true description: ' A list of the meetings of this section (each meeting is a continuous span of time during which a section would meet). ' location_string: type: string nullable: true description: ' This represents the location that the user can input themselves. Will use a building object from a drop down or have it validated or something so it can interact with map. Didn''t want to run into issue of users creating arbitrary Room objects, so just using a char field ' maxLength: 80 name: type: string description: ' The user''s name for the break. No two breaks can match in all of the fields `[name, person]` ' maxLength: 255 checked: type: boolean description: ' Whether or not the break has been checked by the user. This is used to determine if the break should be displayed in the user''s schedule. ' meeting_times: type: string description: ' A JSON-stringified list of meeting times of the form `{days code} {start time} - {end time}`, e.g. `["MWF 09:00 AM - 10:00 AM","F 11:00 AM - 12:00 PM","T 05:00 PM - 06:00 PM"]` for PHYS-151-001 (2020A). Each letter of the days code is of the form M, T, W, R, F for each day of the work week, respectively (and multiple days are combined with concatenation). To access the Meeting objects for this section, the related field `meetings` can be used. ' description: '' '403': description: Access denied (missing or improper authentication). tags: - '[PCP] Break' delete: operationId: Destroy Break description: '(DELETE `/api/plan/breaks/{id}/`) User authentication required.' parameters: - name: id in: path required: true description: '' schema: type: string responses: '204': description: '' '403': description: Access denied (missing or improper authentication). tags: - '[PCP] Break' x-tagGroups: - name: Penn Course Plan tags: - '[PCP] Course Recommendations' - '[PCP] Schedule' - '[PCP] Primary Schedule' - '[PCP] Calendar' - '[PCP] Break' - name: Penn Course Alert tags: - '[PCA] Registration History' - '[PCA] Registration' - name: Penn Course Review tags: - '[PCR] Course Reviews' - '[PCR] Autocomplete Dump' - '[PCR] Department Reviews' - '[PCR] Section-Specific Reviews' - '[PCR] Plots' - '[PCR] Instructor Reviews' - name: Penn Courses (Base) tags: - '[PCx] NGSS Restrictions' - '[PCx] Attributes' - '[PCx] Status Updates' - '[PCx] Healths' - '[PCx] Friendship' - '[PCx] Course' - '[PCx] Section' - '[PCx] Pre-NGSS Requirements' - name: Penn Labs Accounts tags: - '[Accounts] User' - name: Other tags: - '[PDP] Docked Course' - '[PDP] Degree' - '[PDP] Onboard From Transcript' - '[PDP] Fulfillment' - '[PDP] Degree Plan Lists' - '[PDP] Satisfied Rule Lists' - '[PDP] Degree Plan Detail'