Skip to content

Doubtfire API

List of Doubtfire

API: Teaching period

teaching_period : Operations about teaching_period This markdown document provides detailed documentation for the “teaching_period” API endpoints including their URLs, methods, parameters, responses, and example requests using curl.

This “teaching_period” API has the following operations.

  • POST /api/teaching_periods/{existing_teaching_period_id}/rollover
  • DELETE /api/teaching_periods/{teaching_period_id}
  • GET /api/teaching_periods/{id}
  • PUT /api/teaching_periods/{id}
  • GET /api/teaching_periods
  • POST /api/teaching_periods
  • DELETE /api/teaching_periods/{teaching_period_id}/breaks/{id}
  • PUT /api/teaching_periods/{teaching_period_id}/breaks/{id}
  • GET /api/teaching_periods/{teaching_period_id}/breaks
  • POST /api/teaching_periods/{teaching_period_id}/breaks

POST: Rollover a Teaching Period

POST /api/teaching_periods/{existing_teaching_period_id}/rollover

  • URL: /api/teaching_periods/{existing_teaching_period_id}/rollover

  • Method: POST

  • Parameters:

  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: quNNcGRv8bLteyUXqE6T' -d 'new_teaching_period_id=5&rollover_inactive=true&search_forward=true' 'http://localhost:3000/api/teaching_periods/3/rollover'
  • Response body: null


DELETE: Delete a teaching period

DELETE /api/teaching_periods/{teaching_period_id}

  • URL: /api/teaching_periods/{teaching_period_id}

  • Method: DELETE

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
    teaching_period_idpathintegerYes
    idpathintegerYes
  • Response: 204

  • Example Request:

    Terminal window
    curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 6NuPzeRAruwgNtHo8V39' 'http://localhost:3000/api/teaching_periods/4'
  • Response body: Teaching period deleted


GET: Get a teaching period’s details

GET /api/teaching_periods/{id}

  • URL: /api/teaching_periods/{teaching_period_id}

  • Method: GET

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    idpathintegerYes
  • Response: 200 OK: Get a teaching period’s details

  • Example Request:

    Terminal window
    curl -X GET --header 'Accept: application/json' 'http://localhost:3000/api/teaching_periods/1'
  • Response body:

    {
    "id": 1,
    "period": "T1",
    "year": 2018,
    "start_date": "2018-03-05T00:00:00.000Z",
    "end_date": "2018-05-25T00:00:00.000Z",
    "active_until": "2018-06-15T00:00:00.000Z",
    "active": false,
    "breaks": [
    {
    "id": 1,
    "start_date": "2018-03-30",
    "number_of_weeks": 1
    }
    ],
    "units": []
    }

PUT: Update teaching period

PUT /api/teaching_periods/{id}

  • URL: /api/teaching_periods/{id}

  • Method: PUT

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    idThe teaching period id to updatepathintegerYes
    teaching_period[period]The name of the teaching periodformDataString
    teaching_period[year]The year of the teaching periodformDatainteger
    teaching_period[start_date]The start date of the teaching periodformDatadate
    teaching_period[end_date]The end date of the teaching periodformDatainteger
    teaching_period[active_until]The teaching period will be active until this dateformDatainteger
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: YhcqgVjqxGDmbxvyfk1q' -d 'teaching_period%5Bactive_until%5D=2024-06-15T00%3A00%3A00.000Z' 'http://localhost:3000/api/teaching_periods/4'
  • Response body:

    {
    "id": 4,
    "period": "T1",
    "year": 2024,
    "start_date": "2024-03-05T00:00:00.000Z",
    "end_date": "2024-05-25T00:00:00.000Z",
    "active_until": "2024-06-15T00:00:00.000Z",
    "active": true
    }

GET: Get all the Teaching Periods

GET /api/teaching_periods

  • URL: /api/teaching_periods

  • Method: GET

  • Parameters:

  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X GET --header 'Accept: application/json' 'http://localhost:3000/api/teaching_periods'
  • Response body:

    [
    {
    "id": 1,
    "period": "T1",
    "year": 2018,
    "start_date": "2018-03-05T00:00:00.000Z",
    "end_date": "2018-05-25T00:00:00.000Z",
    "active_until": "2018-06-15T00:00:00.000Z",
    "active": false
    },
    {
    "id": 2,
    "period": "T2",
    "year": 2018,
    "start_date": "2018-07-09T00:00:00.000Z",
    "end_date": "2018-09-28T00:00:00.000Z",
    "active_until": "2018-10-19T00:00:00.000Z",
    "active": false
    },
    {
    "id": 3,
    "period": "T3",
    "year": 2018,
    "start_date": "2018-11-05T00:00:00.000Z",
    "end_date": "2019-02-01T00:00:00.000Z",
    "active_until": "2019-02-15T00:00:00.000Z",
    "active": false
    }
    ]

POST: Add a Teaching Period

POST /api/teaching_periods

  • URL: /api/teaching_periods

  • Method: POST

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    teaching_period[period]The name of the teaching periodformDataStringYes
    teaching_period[year]The year of the teaching periodformDataintegerYes
    teaching_period[start_date]The start date of the teaching periodformDatadateYes
    teaching_period[end_date]The end date of the teaching periodformDataintegerYes
    teaching_period[active_until]The teaching period will be active until this dateformDataintegerYes
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
  • Response: 201 Created

  • Example Request:

    Terminal window
    curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: YhcqgVjqxGDmbxvyfk1q' -d 'teaching_period%5Bperiod%5D=T1&teaching_period%5Byear%5D=2024&teaching_period%5Bstart_date%5D=2024-03-05T00%3A00%3A00.000Z&teaching_period%5Bend_date%5D=2024-05-25T00%3A00%3A00.000Z&teaching_period%5Bactive_until%5D=2024-06-25T00%3A00%3A00.000Z' 'http://localhost:3000/api/teaching_periods'
  • Response body:

    {
    "id": 4,
    "period": "T1",
    "year": 2024,
    "start_date": "2024-03-05T00:00:00.000Z",
    "end_date": "2024-05-25T00:00:00.000Z",
    "active_until": "2024-06-25T00:00:00.000Z",
    "active": true
    }

DELETE: Remove a break from a teaching period

DELETE /api/teaching_periods/{teaching_period_id}/breaks/{id}

  • URL: /api/teaching_periods/{teaching_period_id}/breaks/{id}

  • Method: DELETE

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
    teaching_period_idpathintegerYes
    idpathintegerYes
  • Response: 204

  • Example Request:

    Terminal window
    curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 6NuPzeRAruwgNtHo8V39' 'http://localhost:3000/api/teaching_periods/4/breaks/4'
  • Response body: true


PUT: Update a break in the teaching period

PUT /api/teaching_periods/{teaching_period_id}/breaks/{id}

  • URL: /api/teaching_periods/{teaching_period_id}/breaks/{id}

  • Method: PUT

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    start_dateThe start date of the teaching periodformDatadate
    number_of_weeksBreak durationformDatainteger
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
    teaching_period_idpathintegerYes
    idpathintegerYes
  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 6NuPzeRAruwgNtHo8V39' -d 'number_of_weeks=2' 'http://localhost:3000/api/teaching_periods/4/breaks/4'
  • Response body:

    {
    "id": 4,
    "start_date": "2024-04-12",
    "number_of_weeks": 2
    }

GET: Get all the breaks in the Teaching Period

GET /api/teaching_periods/{teaching_period_id}/breaks

  • URL: /api/teaching_periods/{teaching_period_id}/breaks/{id}

  • Method: GET

  • Parameters:

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
    teaching_period_idpathintegerYes
  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: YhcqgVjqxGDmbxvyfk1q' 'http://localhost:3000/api/teaching_periods/1/breaks'
  • Response body:

    [
    {
    "id": 1,
    "start_date": "2018-03-30",
    "number_of_weeks": 1
    }
    ]

POST: Add a new break to the teaching period

POST /api/teaching_periods/{teaching_period_id}/breaks

  • URL: /api/teaching_periods/{teaching_period_id}/breaks/{id}

  • Method: POST

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    start_dateThe start date of the breakformDatadateYes
    number_of_weeksBreak durationformDataintegerYes
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
    teaching_period_idpathintegerYes
  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: YhcqgVjqxGDmbxvyfk1q' -d 'start_date=2024-04-12T00%3A00%3A00.000Z&number_of_weeks=1' 'http://localhost:3000/api/teaching_periods/4/breaks'
  • Response body:

    {
    "id": 4,
    "start_date": "2024-04-12",
    "number_of_weeks": 1
    }