Skip to content
mihneamandache edited this page Mar 22, 2017 · 17 revisions

Showing details of a group (Authenticated Resource) - must be admin

GET request to https://project-run.herokuapp.com/groups/id/edit Will return the following json format

{
  "id: 1,
  "name": "group name"
  "admins": ["email1", "email2"],
  "students": ["email3", "email4"],
  "pending_invites": ["email5", "email6"]
}

Creating a new group (Authenticated resource)

Creating a new Group can be done by making a POST request to https://project-run.herokuapp.com/groups with the following parameters :

{
    "name": "Name of the Group"
}

Adding/Removing an user to a group (Authenticated resource)

Making an user part of a group can be done by making a POST request to https://project-run.herokuapp.com/groups/[group_id]/add?user_id=[user_id]

Removing an user from a group can be done by making a POST request to``https://project-run.herokuapp.com/groups/[group_id]/delete?user_id=[user_id]`

Showing the quizzes that belong to a group (Authenticated resource)

If you want to list all the quizzes that are available in a certain group you can do so by making a GET request to https://project-run.herokuapp.com/groups/[group_id]/quizzes. A sample response to that kind of request could be :

[
  {
    "id": 1,
    "title": "My quiz 1"
  },
  {
    "id": 7,
    "title": "My quiz 2"
  }
]

Updating the quizzes for a group (Authenticated resource)

POST request to https://project-run.herokuapp.com/groups/[group_id]/quizzes_update with the following format

{
  "quizzes": [quiz_id_1, ..., quiz_id_n]
}

Destroying a group

DELETE to https://project-run.herokuapp.com/groups/[group_id]

Showing the students in a group

GET request to https://project-run.herokuapp.com/groups/[group_id]/students

Sample response:

[
  {
    "id": 2,
    "name": "m",
    "email": "m@gmail.com"
  }
]

Updating the students in a group

POST request to https://project-run.herokuapp.com/groups/[group_id]/users_update with the following parameters:

{
          "users": [
            "email", "email", "email"
          ]
        }

You will get an array with many hashes that have two attributes email and status which can either be added or invited_to_join if the user doesn't have an account. They will automatically join the group once they create their account

Adding students to a group

POST request to https://project-run.herokuapp.com/groups/[group_id]/add_users with the following parameters:

{
          "users": [
            "email", "email", "email"
          ]
        }

You will get an array with many hashes that have two attributes email and status which can either be added or invited_to_join if the user doesn't have an account. They will automatically join the group once they create their account

Search for a group by its name

POST request to https://project-run.herokuapp.com/groups/search with the following parameters:

{
	"input": "test"
}

Sample JSON response body:

{
  "best_match_name": [
    {
      "id": 1,
      "name": "test"
    }
],
  "alternative_match_name": [
    {
      "id": 4,
      "name": "test-group"
    },
    {
      "id": 10,
      "name": "testing groups"
    },
    {
      "id": 11,
      "name": "testing for /quizzes"
    }
  ]
}