Team
Add a member
Add a single member to a team. If the user is already a member privileges are updated.
PUT
/v1/team/:id/memberParameters - Parameter
| Name | Type | Description |
|---|---|---|
| id | String | The unique id of the team to add the user to. |
Request Body
| Name | Type | Description |
|---|---|---|
| user | String | The unique user id or email address of the team member to add. |
| privileges | String | optional The member privileges. Options:
|
Success response example
Success response example - Response
{
"status": 200,
"type": "ok",
"message": "Request worked as expected."
"data": {
"_id": "62b9db151489dd913aeaa22f",
"survey": "62bb4e5aafac21b873847d85",
"user": "62bb4e5aafac21b873847d86",
"created": "2022-04-26T20:19:11.062Z",
"updated": "2022-04-26T20:20:41.187Z",
"members": [
{
"_id": "62bb20e8afac21b873847d7f",
"privileges": "admin",
"user": {
"_id": "5bede5cde8dd7e5d5df79aa9",
"name": {
"first": "Johnny",
"last": "Appleseed"
},
"email": "johnny@example.com",
"photo": "https://media.surveyplanet/image/62bb4e5aafac21b873847d82/62bb4e5aafac21b873847d84.png"
}
},
{
"_id": "626854195f1f68890e82c0cb",
"privileges": "write",
"user": {
"_id": "60fed731dad281fd4467733d",
"name": {
"first": "Pecos",
"last": "Bill"
},
"photo": null,
"email": "pecos@example.com"
}
}
]
}
} Create a team
Create a single team.
POST
/v1/teamRequest Body
| Name | Type | Description |
|---|---|---|
| survey | String | The survey id the team is associated with. |
Examples
curl https://api.surveyplanet.com/v1/team
--request POST
--header "Content-Type: application/json"
--header "Authorization: Bearer <ACCESS_TOKEN>"
--data '{"survey":"62b9db151489dd913aeaa22f"}'// For Node.js considering using the 'node-fetch' library: npm info node-fetch
fetch(`https://api.surveyplanet.com/v1/team`, {
method: "POST"
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <ACCESS_TOKEN>",
}
body: JSON.stringify({"survey":"62b9db151489dd913aeaa22f"})
})
.then( response => response.json() )
.then( res => console.log(res.data) )
.catch( err => console.error(err) );# This code sample uses the 'requests' library: pip show requests
import requests
response = requests.post(
'https://api.surveyplanet.com/v1/team',
headers = {
"Content-Type": "application/json"
"Authorization": "Bearer <ACCESS_TOKEN>"
}
data = {"survey":"62b9db151489dd913aeaa22f"}
)
print(response.text)Success response example
Success response example - Response
{
"status": 200,
"type": "ok",
"message": "Request worked as expected."
"data": {
"_id": "62b9db151489dd913aeaa22f",
"survey": "62bb4e5aafac21b873847d85",
"user": "62bb4e5aafac21b873847d86",
"created": "2022-04-26T20:19:11.062Z",
"updated": "2022-04-26T20:20:41.187Z",
"members": [
{
"_id": "62bb20e8afac21b873847d7f",
"privileges": "admin",
"user": {
"_id": "5bede5cde8dd7e5d5df79aa9",
"name": {
"first": "Johnny",
"last": "Appleseed"
},
"email": "johnny@example.com",
"photo": "https://media.surveyplanet/image/62bb4e5aafac21b873847d82/62bb4e5aafac21b873847d84.png"
}
},
{
"_id": "626854195f1f68890e82c0cb",
"privileges": "write",
"user": {
"_id": "60fed731dad281fd4467733d",
"name": {
"first": "Pecos",
"last": "Bill"
},
"photo": null,
"email": "pecos@example.com"
}
}
]
}
} Delete a member
Remove a single member from a team.
DELETE
/v1/team/:id/member/:userParameters - Parameter
| Name | Type | Description |
|---|---|---|
| id | String | The unique team id. |
| user | String | The unique user id of the team member to be removed. |
Examples
curl https://api.surveyplanet.com/v1/team/62b9db151489dd913aeaa22f/member/62bb4e5aafac21b873847d84
--request DELETE
--header "Content-Type: application/json"
--header "Authorization: Bearer <ACCESS_TOKEN>"// For Node.js considering using the 'node-fetch' library: npm info node-fetch
fetch(`https://api.surveyplanet.com/v1/team/62b9db151489dd913aeaa22f/member/62bb4e5aafac21b873847d84`, {
method: "DELETE"
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <ACCESS_TOKEN>",
}
})
.then( response => response.json() )
.then( res => console.log(res.data) )
.catch( err => console.error(err) );# This code sample uses the 'requests' library: pip show requests
import requests
response = requests.delete(
'https://api.surveyplanet.com/v1/team/62b9db151489dd913aeaa22f/member/62bb4e5aafac21b873847d84',
headers = {
"Content-Type": "application/json"
"Authorization": "Bearer <ACCESS_TOKEN>"
}
)
print(response.text)Success response example
Success response example - Response
{
"status": 200,
"type": "ok",
"message": "Request worked as expected."
"data": {
"_id": "62b9db151489dd913aeaa22f",
"survey": "62bb4e5aafac21b873847d85",
"user": "62bb4e5aafac21b873847d86",
"created": "2022-04-26T20:19:11.062Z",
"updated": "2022-04-26T20:20:41.187Z",
"members": [
{
"_id": "62bb20e8afac21b873847d7f",
"privileges": "admin",
"user": {
"_id": "5bede5cde8dd7e5d5df79aa9",
"name": {
"first": "Johnny",
"last": "Appleseed"
},
"email": "johnny@example.com",
"photo": "https://media.surveyplanet/image/62bb4e5aafac21b873847d82/62bb4e5aafac21b873847d84.png"
}
},
{
"_id": "626854195f1f68890e82c0cb",
"privileges": "write",
"user": {
"_id": "60fed731dad281fd4467733d",
"name": {
"first": "Pecos",
"last": "Bill"
},
"photo": null,
"email": "pecos@example.com"
}
}
]
}
} Delete a team
Delete a single team.
DELETE
/v1/team/:idParameters - Parameter
| Name | Type | Description |
|---|---|---|
| id | String | The unique team id to be deleted. |
Examples
curl https://api.surveyplanet.com/v1/team/62b9db151489dd913aeaa22f
--request DELETE
--header "Content-Type: application/json"
--header "Authorization: Bearer <ACCESS_TOKEN>"// For Node.js considering using the 'node-fetch' library: npm info node-fetch
fetch(`https://api.surveyplanet.com/v1/team/62b9db151489dd913aeaa22f`, {
method: "DELETE"
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <ACCESS_TOKEN>",
}
})
.then( response => response.json() )
.then( res => console.log(res.data) )
.catch( err => console.error(err) );# This code sample uses the 'requests' library: pip show requests
import requests
response = requests.delete(
'https://api.surveyplanet.com/v1/team/62b9db151489dd913aeaa22f',
headers = {
"Content-Type": "application/json"
"Authorization": "Bearer <ACCESS_TOKEN>"
}
)
print(response.text)Success response example
Success response example - Response
{
"status": 200,
"type": "ok",
"message": "Request worked as expected."
"data": {
"_id": "62b9db151489dd913aeaa22f",
"survey": "62bb4e5aafac21b873847d85",
"user": "62bb4e5aafac21b873847d86",
"created": "2022-04-26T20:19:11.062Z",
"updated": "2022-04-26T20:20:41.187Z",
"members": [
{
"_id": "62bb20e8afac21b873847d7f",
"privileges": "admin",
"user": {
"_id": "5bede5cde8dd7e5d5df79aa9",
"name": {
"first": "Johnny",
"last": "Appleseed"
},
"email": "johnny@example.com",
"photo": "https://media.surveyplanet/image/62bb4e5aafac21b873847d82/62bb4e5aafac21b873847d84.png"
}
},
{
"_id": "626854195f1f68890e82c0cb",
"privileges": "write",
"user": {
"_id": "60fed731dad281fd4467733d",
"name": {
"first": "Pecos",
"last": "Bill"
},
"photo": null,
"email": "pecos@example.com"
}
}
]
}
} Get a team
Retrieves a single survey team. The id can be either the team id or the associated survey id.
GET
/v1/team/:idParameters - Parameter
| Name | Type | Description |
|---|---|---|
| id | String | The unique id of the team or its associated survey. |
Examples
curl https://api.surveyplanet.com/v1/team/62b9db151489dd913aeaa22f
--header "Authorization: Bearer <ACCESS_TOKEN>"// For Node.js considering using the 'node-fetch' library: npm info node-fetch
fetch(`https://api.surveyplanet.com/v1/team/62b9db151489dd913aeaa22f`, {
headers: { Authorization: 'Bearer <ACCESS_TOKEN>' },
})
.then((response) => response.json())
.then((res) => console.log(res.data))
.catch((err) => console.error(err));# This code sample uses the 'requests' library: pip show requests
import requests
response = requests.get(
"https://api.surveyplanet.com/v1/team/62b9db151489dd913aeaa22f",
headers={"Authorization": "Bearer <ACCESS_TOKEN>"}
)
print(response.text)Success response example
Success response example - Response
{
"status": 200,
"type": "ok",
"message": "Request worked as expected."
"data": {
"_id": "62b9db151489dd913aeaa22f",
"survey": "62bb4e5aafac21b873847d85",
"user": "62bb4e5aafac21b873847d86",
"created": "2022-04-26T20:19:11.062Z",
"updated": "2022-04-26T20:20:41.187Z",
"members": [
{
"_id": "62bb20e8afac21b873847d7f",
"privileges": "admin",
"user": {
"_id": "5bede5cde8dd7e5d5df79aa9",
"name": {
"first": "Johnny",
"last": "Appleseed"
},
"email": "johnny@example.com",
"photo": "https://media.surveyplanet/image/62bb4e5aafac21b873847d82/62bb4e5aafac21b873847d84.png"
}
},
{
"_id": "626854195f1f68890e82c0cb",
"privileges": "write",
"user": {
"_id": "60fed731dad281fd4467733d",
"name": {
"first": "Pecos",
"last": "Bill"
},
"photo": null,
"email": "pecos@example.com"
}
}
]
}
}