Skip to content

Instantly share code, notes, and snippets.

@shaisachs
Last active October 19, 2020 18:12
Show Gist options
  • Save shaisachs/d6788c4eeb4d5e2e716fa5938b8fa732 to your computer and use it in GitHub Desktop.
Save shaisachs/d6788c4eeb4d5e2e716fa5938b8fa732 to your computer and use it in GitHub Desktop.
VAN Demo Postman collection
{
"info": {
"_postman_id": "3fea52d3-a544-418a-8c8c-933255e13371",
"name": "VAN demo",
"description": "Indicates how to run some very common API requests in VAN. More complete documentation at https://developers.ngpvan.com/.\r\n\r\nFor security purposes, the fully API key has been redacted, so none of these API calls will work as-is. Before using this collection, please find/replace \"****c70b\" with your actual API key.\r\n\r\nAlso note that some of these API calls have dependencies on earlier API calls - for example, the activist code and survey question in \"Apply canvass responses\" are drawn from the response in \"Get activist codes\" and \"Get survey questions\", respectively. The responses in the \"Get activist codes\" and \"Get survey questions\" API calls are in turn dependent on configuration in the VAN user interface - so different API keys will have different responses. These dependencies are noted in each API call's description.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Verify connection (fake key)",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "3fb0a4b2-545b-42e1-ad70-08bdd52a05c5|1",
"type": "string"
},
{
"key": "username",
"value": "apiuser",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{ \"message\": \"Hello, world.\" }",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.securevan.com/v4/echoes",
"protocol": "https",
"host": [
"api",
"securevan",
"com"
],
"path": [
"v4",
"echoes"
]
}
},
"response": []
},
{
"name": "Verify connection (real key)",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "****c70b|1",
"type": "string"
},
{
"key": "username",
"value": "apiuser",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{ \"message\": \"Hello, world.\" }",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.securevan.com/v4/echoes",
"protocol": "https",
"host": [
"api",
"securevan",
"com"
],
"path": [
"v4",
"echoes"
]
}
},
"response": []
},
{
"name": "Create volunteer",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "****c70b|1",
"type": "string"
},
{
"key": "username",
"value": "apiuser",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"firstName\": \"Anne\",\r\n \"lastName\": \"Perkins\",\r\n \"email\": \"anne.perkins@pawnee.in.us.example.org\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.securevan.com/v4/people/findOrCreate",
"protocol": "https",
"host": [
"api",
"securevan",
"com"
],
"path": [
"v4",
"people",
"findOrCreate"
]
}
},
"response": []
},
{
"name": "Get events",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "****c70b|1",
"type": "string"
},
{
"key": "username",
"value": "apiuser",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "https://api.securevan.com/v4/events",
"protocol": "https",
"host": [
"api",
"securevan",
"com"
],
"path": [
"v4",
"events"
]
}
},
"response": []
},
{
"name": "Get event details",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "****c70b|1",
"type": "string"
},
{
"key": "username",
"value": "apiuser",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "https://api.securevan.com/v4/events/175091?$expand=shifts,roles,locations",
"protocol": "https",
"host": [
"api",
"securevan",
"com"
],
"path": [
"v4",
"events",
"175091"
],
"query": [
{
"key": "$expand",
"value": "shifts,roles,locations"
}
]
},
"description": "Note that the event ID in the URL is drawn from the body of the \"Get events\" response."
},
"response": []
},
{
"name": "Get event statuses",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "****c70b|1",
"type": "string"
},
{
"key": "username",
"value": "apiuser",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "https://api.securevan.com/v4/signups/statuses?eventId=173921",
"protocol": "https",
"host": [
"api",
"securevan",
"com"
],
"path": [
"v4",
"signups",
"statuses"
],
"query": [
{
"key": "eventId",
"value": "173921"
}
]
},
"description": "Note that the event ID in the URL is the same as that in the \"Get event details\" request."
},
"response": []
},
{
"name": "Signup for event",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "****c70b|1",
"type": "string"
},
{
"key": "username",
"value": "apiuser",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"person\": {\r\n \"vanId\": 101666924\r\n },\r\n \"event\": {\r\n \"eventId\": 175091\r\n },\r\n \"location\": {\r\n \"locationId\": 6391\r\n },\r\n \"shift\": {\r\n \"eventShiftId\": 224104\r\n },\r\n \"role\": {\r\n \"roleId\": 272152\r\n },\r\n \"status\": {\r\n \"statusId\": 1\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.securevan.com/v4/signups",
"protocol": "https",
"host": [
"api",
"securevan",
"com"
],
"path": [
"v4",
"signups"
]
},
"description": "Note that event Id, event shift Id, and roleId are drawn from the \"Get event details\" response; statusId is drawn from the \"Get event statuses\" response."
},
"response": []
},
{
"name": "Get activist codes",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "****c70b|0",
"type": "string"
},
{
"key": "username",
"value": "apiuser",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "https://api.securevan.com/v4/activistCodes",
"protocol": "https",
"host": [
"api",
"securevan",
"com"
],
"path": [
"v4",
"activistCodes"
]
}
},
"response": []
},
{
"name": "Get survey questions",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "****c70b|0",
"type": "string"
},
{
"key": "username",
"value": "apiuser",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "https://api.securevan.com/v4/surveyQuestions",
"protocol": "https",
"host": [
"api",
"securevan",
"com"
],
"path": [
"v4",
"surveyQuestions"
]
}
},
"response": []
},
{
"name": "Apply canvass responses",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "****c70b|0",
"type": "string"
},
{
"key": "username",
"value": "apiuser",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"canvassContext\": {\r\n \"contactTypeId\": 2,\r\n \"inputTypeId\": 14,\r\n \"dateCanvassed\": \"2020-10-06T14:00:00-04:00\"\r\n },\r\n \"responses\": [\r\n {\r\n \"activistCodeId\": 4755971,\r\n \"action\": \"Apply\",\r\n \"type\": \"ActivistCode\"\r\n },\r\n {\r\n \"surveyQuestionId\": 425733,\r\n \"surveyResponseId\": 1738509,\r\n \"type\": \"SurveyResponse\"\r\n }\r\n ]\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.securevan.com/v4/people/59772/canvassResponses",
"protocol": "https",
"host": [
"api",
"securevan",
"com"
],
"path": [
"v4",
"people",
"59772",
"canvassResponses"
]
},
"description": "Note that the activist code Id is drawn from the \"Get activist codes\" response; the survey question Id and survey response Id are drawn from the \"Get survey questions\" response."
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "37a18a1c-0602-4886-871a-56687dbfee6e",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "c0a4f78b-f0c7-4ad7-ac43-711dce6b7e84",
"type": "text/javascript",
"exec": [
""
]
}
}
],
"protocolProfileBehavior": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment