Team

Add a member

Back to top

Add a single member to a team. If the user is already a member privileges are updated.

PUT
/v1/team/:id/member

Parameters - Parameter

NameTypeDescription
idString

The unique id of the team to add the user to.

Request Body

NameTypeDescription
userString

The unique user id or email address of the team member to add.

privilegesStringoptional

The member privileges. Options:

  • read: member has read access to the survey.
  • write: member has read and write access to the survey.
  • admin: member has read, write, and can add members to the survey team.
Default value: read

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

Back to top

Create a single team.

POST
/v1/team

Request Body

NameTypeDescription
surveyString

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

Back to top

Remove a single member from a team.

DELETE
/v1/team/:id/member/:user

Parameters - Parameter

NameTypeDescription
idString

The unique team id.

userString

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

Back to top

Delete a single team.

DELETE
/v1/team/:id

Parameters - Parameter

NameTypeDescription
idString

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

Back to top

Retrieves a single survey team. The id can be either the team id or the associated survey id.

GET
/v1/team/:id

Parameters - Parameter

NameTypeDescription
idString

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"
          }
        }
      ]
  }
}