List Swarm Members
Endpoint: /api/swarm/:swarm_id/member/
Fetch all members in a swarm.
Method | Action | Parameters |
---|---|---|
GET | Get swarm members |
|
An example of a return response:
{
"limit":20,
"offset":0,
"previous":null,
"next":"/api/swarm/67521/member/?offset=20&limit=20",
"total_count":28,
"collection": [
{
"id": 4535,
"relationship": "member",
"role": "",
"start_at": {
"friendly_time": "yesterday",
"date_local": "22.1.2015",
"date": "Thu, 22 Jan 2015 14:17:43 +0200"
},
"end_at": null,
"created_at": {
"friendly_time": "two weeks ago",
"date_local": "22.1.2015",
"date": "Thu, 22 Jan 2015 14:17:43 +0200"
},
"updated_at": {
"friendly_time": "yesterday",
"date_local": "22.1.2015",
"date": "Thu, 22 Jan 2015 14:17:43 +0200"
},
"user": {
"id": 4535,
"name": "Skillhive Tester",
"uri": "\/api\/user\/4535",
"icon_url": ""https://skillhive.com/public/user/4535/icon/small/"",
"email": "testuser@skillhive.com",
}
},
...
]
}
Add a Member
Endpoint: /api/swarm/:swarm_id/member/
Add a new member to swarm.
Method | Action |
---|---|
POST | Add a new member to swarm. |
Possible post parameters:
Parameter | Type | Default | Optional |
---|---|---|---|
user_id | integer | Current user's id | true |
start_at | string | now() |
true |
end_at | string | true |
If user_id
parameter is not sent the user making the request will be added as a member.
Optionally, you can also define start and end dates for the membership. Notice, that the
dates are not used in all swarm types.
If the membership is succesfully created, the returned response will be similar to the result when viewing a single membership.
Get a single Member
Endpoint: /api/swarm/:swarm_id/member/:user_id
Get a membership identified by user_id
,
Method | Action | Parameters |
---|---|---|
GET | Get a membership | N/A |
Return the membership, for instance:
{
"id": 4535,
"relationship": "member",
"role": "",
"start_at": {
"friendly_time": "yesterday",
"date_local": "22.1.2015",
"date": "Thu, 22 Jan 2015 14:17:43 +0200"
},
"end_at": null,
"created_at": {
"friendly_time": "two weeks ago",
"date_local": "22.1.2015",
"date": "Thu, 22 Jan 2015 14:17:43 +0200"
},
"updated_at": {
"friendly_time": "yesterday",
"date_local": "22.1.2015",
"date": "Thu, 22 Jan 2015 14:17:43 +0200"
},
"user": {
"id": 4535,
"name": "Skillhive Tester",
"uri": "\/api\/user\/4535",
"icon_url": ""https://skillhive.com/public/user/4535/icon/small/"",
"email": "testuser@skillhive.com",
}
}
Some swarm types can have special user roles in the swarm. For instance, course swarms may have teachers and onboarding swarms might have onboardess.
Update a Membership
Endpoint: /api/swarm/:swarm_id/member/:user_id
Update an existing membership identified by user_id
.
Method | Action | Parameters |
---|---|---|
PUT | Update a membership |
|
If the membership is succesfully updated, the returned response will be similar to the result when viewing a single membership.
Remove a Member
Endpoint: /api/swarm/:swarm_id/member/:user_id
Remove a user from swarm identified by user_id
.
Method | Action | Parameters |
---|---|---|
DELETE | Remove a member. | N/A |
If the member is succesfully removed, the server will return a HTTP Response with status code 200.