Skip to content

Doubtfire API Documentation

API: Campuses

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

This “campuses” API has the following operations.

  • DELETE /api/campuses/{id}
  • GET /api/campuses/{id}
  • PUT /api/campuses/{id}
  • GET /api/campuses
  • POST /api/campuses

DELETE: Delete a campus.

Delete /api/campuses/{id}

  • URL: /api/campuses/{id}

  • Method: DELETE

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
    idpathintegerYes
  • Response: 204 OK: Campus deleted successfully.

  • Example Request:

    Terminal window
    curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: yzRDggcmzbVnYEbszVV1' 'http://localhost:3000/api/campuses/6'
  • Response body:

    true

GET: fetches a campuses details by ID

GET /api/campuses/{id}

  • URL: /api/campuses/{id}

  • Method: GET

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    idpathintegerYes
  • Response: 200 OK

  • Example Request:

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

    {
    "id": 4,
    "name": "Geelong_1",
    "mode": "timetable",
    "abbreviation": "gee test1",
    "active": true
    }

PUT: Update campus detail for specific ID

PUT /api/campuses/{id}

  • URL: /campuses/{id}

  • Method: PUT

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    campus[name]The name of the campusformDatastringYes
    campus[mode]This will determine the campus modeformDatastringYes
    campus[abbreviation]The abbreviation for the campusheaderstringYes
    campus[active]Determines whether campus is activeheaderstringYes
    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: yzRDggcmzbVnYEbszVV1' -d 'campus%5Bname%5D=Geelong_1&campus%5Bmode%5D=automatic&campus%5Bactive%5D=true' 'http://localhost:3000/api/campuses/4'
  • Response Body

    {
    "id": 4,
    "name": "Geelong_1",
    "mode": "automatic",
    "abbreviation": "gee test1",
    "active": true
    }

GET: fetches a details of all campuses

GET /api/campuses

  • URL: /api/campuses

  • Method: GET

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    idpathintegerYes
  • Response: 200 OK

  • Example Request:

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

    [
    {
    "id": 1,
    "name": "Online",
    "mode": "timetable",
    "abbreviation": "C",
    "active": true
    },
    {
    "id": 2,
    "name": "Burwood",
    "mode": "automatic",
    "abbreviation": "B",
    "active": true
    },
    {
    "id": 3,
    "name": "Geelong",
    "mode": "manual",
    "abbreviation": "G",
    "active": true
    },
    {
    "id": 4,
    "name": "Geelong_1",
    "mode": "timetable",
    "abbreviation": "gee test1",
    "active": true
    }
    ]

POST: Add a Campus

POST /api/campuses

  • URL: /api/campuses

  • Method: POST

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    campus[name]The name of the campusformDatastringYes
    campus[mode]This will determine the campus modeformDatastringYes
    campus[abbreviation]The abbreviation for the campusheaderstringYes
    campus[active]Determines whether campus is activeheaderstringYes
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
  • Response: 201 Created: Add a campus

  • 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: yzRDggcmzbVnYEbszVV1' -d 'campus%5Bname%5D=Geelong_2&campus%5Bmode%5D=timetable&campus%5Babbreviation%5D=gee%20test2&campus%5Bactive%5D=true' 'http://localhost:3000/api/campuses'
  • Response body:

    {
    "id": 5,
    "name": "Geelong_2",
    "mode": "timetable",
    "abbreviation": "gee test2",
    "active": true
    }