Skip to content

Doubtfire API Documentation

API: Activity Types

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

This “activity_types” API has the following operations.

  • GET: /api/activity_types
  • POST: /api/activity_types
  • DELETE: /api/activity_types/{id}
  • GET: /api/activity_types/{id}
  • PUT: /api/activity_types/{id}

GET activity_types: gets a list of all activity types.

GET /api/activity_types

  • URL: api/activity_types

  • Method: GET

  • Parameters: None

  • Response: 200 OK

  • Example Request:

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

    [
    {
    "id": 1,
    "name": "Practical",
    "abbreviation": "prac"
    },
    {
    "id": 2,
    "name": "Workshop",
    "abbreviation": "wrkshop"
    },
    {
    "id": 3,
    "name": "Class",
    "abbreviation": "cls"
    },
    ]

POST activity_types: creates or adds a new activity type

POST/api/activity_types

  • URL: api/activity_types

  • Method: POST

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    nameThe name of the activity typeformDatastringYes
    abbreviationThe abbreviation for the activity typeformDatastringYes
    Usernameenter the 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: 9zV37yx2jQ3j8Nsy4MP_' -d 'activity_type%5Bname%5D=Practical1&activity_type%5Babbreviation%5D=prac1' 'http://localhost:3000/api/activity_types'
  • Response Body

    {
    "id": 4,
    "name": "Practical1",
    "abbreviation": "prac1"
    }

DELETE activity_types: delete an activity type

DELETE /api/activity_types/{id}

  • URL: api/activity_types/{id}

  • Method: DELETE

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    Usernameenter the usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
    idpathintegerYes
  • Response: 204 No Content

  • Example request

    Terminal window
    curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 5zR37VDdBV6FZvJzABPS' 'http://localhost:3000/api/activity_types/4'

GET: Get an activity type details

GET /api/activity_types/{id}

  • URL: api/activity_types/{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/activity_types/3'
  • Response Body:

    {
    "id": 3,
    "name": "Class",
    "abbreviation": "cls"
    }

PUT: Update an activity type

PUT /api/activity_types/{id}

  • URL: api/activity_types/{id}

  • Method: PUT

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    activity_type [name]The name of the activity typeformDatastring
    activity_type [abbreviation]The abbreviation for the activity typeformDatastring
    Usernameenter the usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
    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: nHyAVEAsSp25snxiLomP' -d 'activity_type%5Bname%5D=Practical1&activity_type%5Babbreviation%5D=prac1' 'http://localhost:3000/api/activity_types/5'
  • Response Body

    {
    "id": 5,
    "name": "Practical1",
    "abbreviation": "prac1"
    }