Participants

Delete a participant

Back to top

Removes a particular survey participant and answers.

DELETE
/v1/participant/:id

Parameters - Parameter

NameTypeDescription
idString

The unique id of the participant to delete.

Examples

curl https://api.surveyplanet.com/v1/participant/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/participant/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/participant/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",
    "index": 42,
    "survey": "5bede977e8dd7e5d5df79dab",
    "email": "",
    "referer": "",
    "ip": "89.41.26.43",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36",
    "created": "2022-03-30T19:04:55.611Z",
    "user": "5bede5cde8dd7e5d5df79aa9",
    "updated": "2022-03-30T19:04:56.583Z",
    "time": {
      "start": "2022-03-30T19:04:18.000Z",
      "end": "2022-03-30T19:04:54.000Z",
      "total": 36000
    },
    "technology": {
      "browser": {
        "major": "99",
        "version": "99.0.4844.84",
        "name": "Chrome"
      },
      "os": {
        "version": "10.15.7",
        "name": "Mac OS"
      }
    },
    "geo": {
      "city": "Los Angeles",
      "country": "United States",
      "latitude": 34.04563903808594,
      "longitude": -118.24163818359375
    }
  }
}

Delete all participants

Back to top

Removes all the participants and answers for a survey.

DELETE
/v1/participants/:survey

Parameters - Parameter

NameTypeDescription
surveyString

The unique survey id to clear all results for.

Examples

curl https://api.surveyplanet.com/v1/participant/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/participant/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/participant/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": {
    "success": true
  }
}

Get a participant

Back to top

Retrieves a single participant by id.

GET
/v1/participant/:id

Parameters - Parameter

NameTypeDescription
idString

The unique id of the participant to retrieve.

Examples

curl https://api.surveyplanet.com/v1/participant/62b9db151489dd913aeaa22f 
--header "Accept: 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/participant/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/participant/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",
    "index": 42,
    "survey": "5bede977e8dd7e5d5df79dab",
    "email": "",
    "referer": "",
    "ip": "89.41.26.43",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36",
    "created": "2022-03-30T19:04:55.611Z",
    "user": "5bede5cde8dd7e5d5df79aa9",
    "updated": "2022-03-30T19:04:56.583Z",
    "time": {
      "start": "2022-03-30T19:04:18.000Z",
      "end": "2022-03-30T19:04:54.000Z",
      "total": 36000
    },
    "technology": {
      "browser": {
        "major": "99",
        "version": "99.0.4844.84",
        "name": "Chrome"
      },
      "os": {
        "version": "10.15.7",
        "name": "Mac OS"
      }
    },
    "geo": {
      "city": "Los Angeles",
      "country": "United States",
      "latitude": 34.04563903808594,
      "longitude": -118.24163818359375
    }
  }
}

List all participants

Back to top

Retrieves all the participants for a particular survey.

GET
/v1/participants

Query Parameters

NameTypeDescription
surveyString

The unique survey id to get all participants for.

Examples

curl https://api.surveyplanet.com/v1/participants?survey=62b9db151489dd913aeaa22f 
--header "Authorization: Bearer <ACCESS_TOKEN>"
// For Node.js considering using the 'node-fetch' library: npm info node-fetch
const urlSearchParams = new URLSearchParams({ survey: '62b9db151489dd913aeaa22f' });
fetch(`https://api.surveyplanet.com/v1/participants?urlSearchParams`, {
	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/participants",
  headers={"Authorization": "Bearer <ACCESS_TOKEN>"}
  params={"survey":"62b9db151489dd913aeaa22f"}
)
print(response.text)

Success response example

Success response example - Response

{
  "status": 200,
  "data": [
    { "_id": "62b9e7467854aef07faa746a",...},
    { "_id": "55d8aa7f2c5105f22fea7cbf",...},
    [...],
  ],
 "more": true,
 "type": "ok",
 "message": "Request worked as expected."
}