{"_id":"5b0e6faab7156300039cbcc9","title":"About","version":"5b0e6faab7156300039cbccd","project":"5474cf1d59fade080004ca59","slug":"about","updates":[],"user":"5474ce9d4f95ac0800481503","createdAt":"2016-11-28T10:13:55.122Z","hidden":false,"order":999,"link_external":false,"next":{"pages":[],"description":""},"sync_unique":"","type":"basic","__v":0,"excerpt":"","githubsync":"","isReference":false,"link_url":"","api":{"url":"","results":{"codes":[]},"settings":"","auth":"required","params":[]},"body":"**Intro**\nThese API docs act as a guide towards integrating with SquadRun for data ops and voice ops workflows.\n\nIt is broken into 4 parts\n1. [Auth endpoints](doc:oauthtoken) - These enable generation/revoking of authentication tokens\n2. [Data ops endpoints](doc:items-api)   - Endpoints for integrating data operations workflows\n3. [Voice ops endpoints](doc:voiceapiitems) - Endpoints for integrating voice operations workflow\n4. New [Project endpoints](doc:bizapiproject-nameitems) - New Endpoints for Project level workflows\n\n**Base URLs**\n- https://app.squadrun.co/ - For production\n- https://staging.squadrun.co/ - For staging\n\n**Dummy token**\nYou can use `test_token` as a dummy test token for testing APIs","category":"5b0e6faab7156300039cbcbd","childrenPages":[]}

About


**Intro** These API docs act as a guide towards integrating with SquadRun for data ops and voice ops workflows. It is broken into 4 parts 1. [Auth endpoints](doc:oauthtoken) - These enable generation/revoking of authentication tokens 2. [Data ops endpoints](doc:items-api) - Endpoints for integrating data operations workflows 3. [Voice ops endpoints](doc:voiceapiitems) - Endpoints for integrating voice operations workflow 4. New [Project endpoints](doc:bizapiproject-nameitems) - New Endpoints for Project level workflows **Base URLs** - https://app.squadrun.co/ - For production - https://staging.squadrun.co/ - For staging **Dummy token** You can use `test_token` as a dummy test token for testing APIs
**Intro** These API docs act as a guide towards integrating with SquadRun for data ops and voice ops workflows. It is broken into 4 parts 1. [Auth endpoints](doc:oauthtoken) - These enable generation/revoking of authentication tokens 2. [Data ops endpoints](doc:items-api) - Endpoints for integrating data operations workflows 3. [Voice ops endpoints](doc:voiceapiitems) - Endpoints for integrating voice operations workflow 4. New [Project endpoints](doc:bizapiproject-nameitems) - New Endpoints for Project level workflows **Base URLs** - https://app.squadrun.co/ - For production - https://staging.squadrun.co/ - For staging **Dummy token** You can use `test_token` as a dummy test token for testing APIs
{"_id":"5b0e6faab7156300039cbcc3","title":"/oauth/token/","updates":["5a0a90ad8ff0c90010af19b2"],"excerpt":"Oauth token generation endpoint","hidden":false,"isReference":false,"parentDoc":null,"project":"5474cf1d59fade080004ca59","category":"5b0e6faab7156300039cbcbe","next":{"description":"","pages":[]},"version":"5b0e6faab7156300039cbccd","link_url":"","order":0,"sync_unique":"","__v":1,"api":{"method":"post","params":[{"in":"body","name":"client_id","ref":"","required":true,"type":"string","_id":"55bf49d1ad601c2b00762c9b","default":"","desc":"Client Identifier"},{"default":"","desc":"Client Secret","in":"body","name":"client_secret","ref":"","required":true,"type":"string","_id":"55bf49d1ad601c2b00762c9a"},{"desc":"password is grant_type that is to be used intially","in":"body","name":"grant_type","ref":"","required":true,"type":"string","_id":"55bf49d1ad601c2b00762c99","default":""},{"in":"body","name":"username","ref":"","required":true,"type":"string","_id":"55bf49d1ad601c2b00762c98","default":"","desc":"Username of the account used to generate the access token"},{"required":true,"type":"string","_id":"55bf49d1ad601c2b00762c97","default":"","desc":"Password of the account used to generate the access token","in":"body","name":"password","ref":""}],"results":{"codes":[{"name":null,"code":"{\n    \"access_token\": \"OBs8bc5PdrzQNd3FaMRp5CkHFhinD9\",\n    \"token_type\": \"Bearer\",\n    \"expires_in\": 36000,\n    \"refresh_token\": \"tEonECLhjMlLf4ZWs56LT43HOrivEt\",\n    \"scope\": \"read write\"\n}","language":"json","status":200},{"name":"Invalid Credentials","code":"{\n    \"error_description\": \"Invalid credentials given.\",\n    \"error\": \"invalid_grant\"\n}","language":"json","status":401},{"code":"{\n    \"error\": \"unsupported_grant_type\"\n}","language":"json","status":400,"name":"Incorrect grant_type"}]},"settings":"55bf4cb0ad601c2b00762cac","url":"/oauth/token/","auth":"never","examples":{"codes":[{"language":"curl","code":"curl -X POST -d \"client_id=test_client_id&client_secret=test_client_secret&grant_type=password&username=test_api_user&password=test_api_user\" https://app.squadrun.co/oauth/token/","name":""},{"language":"python","code":"import requests\n\nurl = \"https://app.squadrun.co/oauth/token/\"\npayload = {\n  \"grant_type\": \"password\", \n  \"client_id\": \"test_client_id\", \n  \"client_secret\": \"test_client_secret\", \n  \"username\": \"test_api_user\", \n  \"password\": \"test_api_user\"\n}\n\nresponse = requests.post(url, payload)\nresponse.json()"},{"language":"ruby","code":"#!/usr/bin/env ruby\nrequire 'faraday'\n\nconn = Faraday.new(:url => 'https://app.squadrun.co') do |faraday|\n  faraday.request  :url_encoded\n  faraday.adapter  Faraday.default_adapter\nend\n\nconn.post '/oauth/token/', { \n  :client_id => 'test_client_id', \n  :client_secret => 'test_client_secret',\n  :grant_type => 'password',\n  :username => 'test_api_user',\n  :password => 'test_api_user'\n}"}]}},"body":"Use this API to generate an access token that can be used rest of the APIs.\n\n## Auth Credentials\nAs mentioned, you need these 4 credentials to retrieve a token from this API:\n1. `username`\n2. `password`\n3. `client_id`\n4. `client_secret`\n\n**They can be found by signing up on [SquadRun's Client Dashboard](https://app.squadrun.co/dashboard/).**\n\nAfter you sign up, you can use the `username` and the `password` in the above API call. \n`client_id` and `client_secret` can be found on the [API Integration Page](https://app.squadrun.co/dashboard/#/dash/api-integration) on the dashboard.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Please note\",\n  \"body\": \"`/oauth/token/` endpoint accepts data as a POST form and not a json dump unlike rest of the APIs below\"\n}\n[/block]\n**Test field values** \n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Value\",\n    \"0-0\": \"`client_id`\",\n    \"0-1\": \"`test_client_id`\",\n    \"1-0\": \"`client_secret`\",\n    \"1-1\": \"`test_client_secret`\",\n    \"2-0\": \"`grant_type`\",\n    \"2-1\": \"`password`\",\n    \"4-0\": \"`username`\",\n    \"4-1\": \"`test_api_user`\",\n    \"3-0\": \"`password`\",\n    \"3-1\": \"`test_api_user`\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]","githubsync":"","link_external":false,"type":"post","user":"5474ce9d4f95ac0800481503","createdAt":"2015-08-03T10:34:36.428Z","slug":"oauthtoken","childrenPages":[]}

post/oauth/token/

Oauth token generation endpoint

Body Params

client_id:
required
string
Client Identifier
client_secret:
required
string
Client Secret
grant_type:
required
string
password is grant_type that is to be used intially
username:
required
string
Username of the account used to generate the access token
password:
required
string
Password of the account used to generate the access token
Use this API to generate an access token that can be used rest of the APIs. ## Auth Credentials As mentioned, you need these 4 credentials to retrieve a token from this API: 1. `username` 2. `password` 3. `client_id` 4. `client_secret` **They can be found by signing up on [SquadRun's Client Dashboard](https://app.squadrun.co/dashboard/).** After you sign up, you can use the `username` and the `password` in the above API call. `client_id` and `client_secret` can be found on the [API Integration Page](https://app.squadrun.co/dashboard/#/dash/api-integration) on the dashboard. [block:callout] { "type": "warning", "title": "Please note", "body": "`/oauth/token/` endpoint accepts data as a POST form and not a json dump unlike rest of the APIs below" } [/block] **Test field values** [block:parameters] { "data": { "h-0": "Field", "h-1": "Value", "0-0": "`client_id`", "0-1": "`test_client_id`", "1-0": "`client_secret`", "1-1": "`test_client_secret`", "2-0": "`grant_type`", "2-1": "`password`", "4-0": "`username`", "4-1": "`test_api_user`", "3-0": "`password`", "3-1": "`test_api_user`" }, "cols": 2, "rows": 5 } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



Use this API to generate an access token that can be used rest of the APIs. ## Auth Credentials As mentioned, you need these 4 credentials to retrieve a token from this API: 1. `username` 2. `password` 3. `client_id` 4. `client_secret` **They can be found by signing up on [SquadRun's Client Dashboard](https://app.squadrun.co/dashboard/).** After you sign up, you can use the `username` and the `password` in the above API call. `client_id` and `client_secret` can be found on the [API Integration Page](https://app.squadrun.co/dashboard/#/dash/api-integration) on the dashboard. [block:callout] { "type": "warning", "title": "Please note", "body": "`/oauth/token/` endpoint accepts data as a POST form and not a json dump unlike rest of the APIs below" } [/block] **Test field values** [block:parameters] { "data": { "h-0": "Field", "h-1": "Value", "0-0": "`client_id`", "0-1": "`test_client_id`", "1-0": "`client_secret`", "1-1": "`test_client_secret`", "2-0": "`grant_type`", "2-1": "`password`", "4-0": "`username`", "4-1": "`test_api_user`", "3-0": "`password`", "3-1": "`test_api_user`" }, "cols": 2, "rows": 5 } [/block]
{"_id":"5b0e6faab7156300039cbcc4","user":"5474ce9d4f95ac0800481503","parentDoc":null,"project":"5474cf1d59fade080004ca59","type":"post","__v":0,"excerpt":"Endpoint to revoke an active oauth token","link_external":false,"link_url":"","isReference":false,"next":{"pages":[],"description":""},"slug":"oauthrevoke_token","title":"/oauth/revoke_token/","createdAt":"2015-08-03T11:48:11.807Z","githubsync":"","hidden":false,"version":"5b0e6faab7156300039cbccd","sync_unique":"","updates":[],"api":{"results":{"codes":[{"code":"","language":"json","status":200,"name":""},{"language":"json","status":400,"name":"","code":"{\n    \"error_description\": \"Missing token parameter.\",\n    \"error\": \"invalid_request\"\n}"}]},"settings":"55bf4cb0ad601c2b00762cac","url":"/oauth/revoke_token/","auth":"required","examples":{"codes":[{"name":"","code":"curl --data \"token=YOUR_TOKEN&client_id=test_client_id&client_secret=test_client_secret\" https://app.squadrun.co/oauth/revoke_token/","language":"curl"},{"code":"import requests\n\nurl = \"https://app.squadrun.co/oauth/token/\"\npayload = {\n  \"client_id\": \"test_client_id\", \n  \"client_secret\": \"test_client_secret\", \n  \"token\t\": \"YOUR_TOKEN\"\n}\n\nresponse = requests.post(url, payload)\nresponse.json()","language":"python"}]},"method":"post","params":[{"ref":"","in":"body","required":false,"desc":"Auth token generated previously that needs to be invalidated","default":"","type":"string","name":"token","_id":"55bf54fbad601c2b00762cc1"},{"in":"body","required":false,"desc":"Client ID used to generate the token","default":"","type":"string","name":"client_id","_id":"55bf54fbad601c2b00762cc0","ref":""},{"required":false,"desc":"Client secret","default":"","type":"string","name":"client_secret","_id":"55bf54fbad601c2b00762cbf","ref":"","in":"body"}]},"body":"Use this API endpoint to revoke an active oauth token.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"`/oauth/revoke_token/` endpoint accepts data as a POST form and not a json dump unlike rest of the APIs below\",\n  \"title\": \"Please note\"\n}\n[/block]","category":"5b0e6faab7156300039cbcbe","order":1,"childrenPages":[]}

post/oauth/revoke_token/

Endpoint to revoke an active oauth token

Body Params

token:
string
Auth token generated previously that needs to be invalidated
client_id:
string
Client ID used to generate the token
client_secret:
string
Client secret
Use this API endpoint to revoke an active oauth token. [block:callout] { "type": "warning", "body": "`/oauth/revoke_token/` endpoint accepts data as a POST form and not a json dump unlike rest of the APIs below", "title": "Please note" } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples



Use this API endpoint to revoke an active oauth token. [block:callout] { "type": "warning", "body": "`/oauth/revoke_token/` endpoint accepts data as a POST form and not a json dump unlike rest of the APIs below", "title": "Please note" } [/block]
{"_id":"5b0e6faab7156300039cbcc7","isReference":false,"createdAt":"2016-11-23T10:21:01.567Z","excerpt":"This API is used to push new tasks for a particular campaign on SquadVoice Platform.","githubsync":"","order":0,"parentDoc":null,"slug":"voiceapiitems","body":"[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Data security\",\n  \"body\": \"Goes without saying your data is secure with us. :)\\n\\nWe call our tele callers via a masked number. This way the `phone_number` you share with us is never shared with our tele callers.\"\n}\n[/block]\n**Multiple tasks per /biz/api/voice/task/ API call**\n\nSample request payload wth multiple tasks per request. You'll receive an identical response in case of success.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"task_id\\\": 5216,\\n    \\\"campaign_id\\\": 12,\\n    \\\"phone_number\\\": \\\"+918743970440\\\",\\n    \\\"meta\\\":\\n    {\\n      \\\"order_name\\\" : \\\"Blue Jeans\\\",\\n      \\\"order_id\\\": 137691334,\\n    },\\n    \\\"contact_name\\\": \\\"John Smith\\\"\\n  },\\n  {\\n    \\\"task_id\\\": 5215,\\n    \\\"campaign_id\\\": 12,\\n    \\\"phone_number\\\": \\\"+918743970445\\\",\\n    \\\"meta\\\":\\n    {\\n      \\\"order_name\\\" : \\\"Black Jeans\\\",\\n      \\\"order_id\\\": 137673874,\\n    },\\n    \\\"contact_name\\\": \\\"John Doe\\\"\\n  }\\n]\",\n      \"language\": \"json\",\n      \"name\": \"Sample request payload\"\n    },\n    {\n      \"code\": \"[\\n  {\\n    \\\"task_id\\\": 5216,\\n    \\\"campaign_id\\\": 12,\\n    \\\"phone_number\\\": \\\"+918743970440\\\",\\n    \\\"meta\\\":\\n    {\\n      \\\"order_name\\\" : \\\"Blue Jeans\\\",\\n      \\\"order_id\\\": 137691334,\\n    },\\n    \\\"contact_name\\\": \\\"John Smith\\\"\\n  },\\n  {\\n    \\\"task_id\\\": 5215,\\n    \\\"campaign_id\\\": 12,\\n    \\\"phone_number\\\": \\\"+918743970445\\\",\\n    \\\"meta\\\":\\n    {\\n      \\\"order_name\\\" : \\\"Black Jeans\\\",\\n      \\\"order_id\\\": 137673874,\\n    },\\n    \\\"contact_name\\\": \\\"John Doe\\\"\\n  }\\n]\",\n      \"language\": \"json\",\n      \"name\": \"201 - Sucess response\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Error Responses\"\n}\n[/block]\n*Require fields are missing*\n\nWhen not all required keys are given, the error response is similar to\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"phone_number\\\": [\\n\\t\\t\\\"This field is required.\\\"\\n\\t],\\n\\t\\\"meta\\\": [\\n\\t\\t\\\"This field is required.\\\"\\n\\t],\\n\\t\\\"task_id\\\": [\\n\\t\\t\\\"This field is required.\\\"\\n\\t],\\n\\t\\\"campaign_id\\\": [\\n\\t\\t\\\"This field is required.\\\"\\n\\t]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"400 - Required fields missing\"\n    },\n    {\n      \"code\": \"HTTP/1.0 400 Bad Request\\nAllow: POST, OPTIONS\\nContent-Type: application/json\",\n      \"language\": \"text\",\n      \"name\": \"headers\"\n    }\n  ]\n}\n[/block]\n**When the task already exists**\n\nThis error occurs when this `task_id` has been used already.\n\nIt might even be possible that the task with given id has been inserted before.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"non_field_errors\\\": [\\n\\t\\t\\\"The field task_id must be unique for this integration.\\\"\\n\\t]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"400 - duplicate task_id\"\n    }\n  ]\n}\n[/block]","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl 'https://app.squadrun.co/biz/api/voice/task/' \\\n-H 'Authorization: Bearer test_token' \\\n-H 'Content-Type: application/json' \\\n--data-binary $'{\"campaign_id\": 12, \"meta\": {\"order_name\": \"Denim Jeans\"}, \"task_id\": 1, \"phone_number\": \"+918743970440\", \"contact_name\": \"John Doe\"}'","name":""},{"language":"python","code":"import requests\nimport json\n\nurl = \"https://app.squadrun.co/biz/api/voice/task/\"\npayload = {\n    \"task_id\": 1, \n    \"campaign_id\": 12, \n\t  \"phone_number\": \"+918743970440\", \n    \"meta\": {\n        \"order_name\": \"Denim Jeans\"\n    }, \n    \"contact_name\": \"John Doe\"\n}\nheaders = {'Authorization': 'Bearer test_token', 'Content-Type': 'application/json'}\n\nresponse = requests.post(url, json.dumps(payload), headers=headers)\nresponse.json()"}]},"method":"post","params":[{"_id":"55bfd89ec49a6a0d00385d5d","ref":"","in":"body","required":true,"desc":"A unique id of the data point. This acts as a unique transaction id for reference in the responses API and the callback/webhook","default":"","type":"int","name":"task_id"},{"_id":"58382321e0ae181900651293","ref":"","in":"body","required":true,"desc":"A unique id for the calling campaign","default":"","type":"int","name":"campaign_id"},{"_id":"58356d8dbd5bc81b00920c19","ref":"","in":"body","required":true,"desc":"Phone number to which we need contact in order to complete the given task.","default":"","type":"string","name":"phone_number"},{"_id":"55bfd89ec49a6a0d00385d5e","ref":"","in":"body","required":true,"desc":"A JSON dump of the data that will contain relevant key values as per your use case.","default":"","type":"object","name":"meta"},{"_id":"58356d8dbd5bc81b00920c18","ref":"","in":"body","required":false,"desc":"Name of the contact for caller to refer receiver by. Max 48 chars.","default":"","type":"string","name":"contact_name"},{"_id":"59849a5454cacf000fc8134b","ref":"","in":"header","required":false,"desc":"","default":"\"application/json\"","type":"string","name":"Content-Type"},{"_id":"59849a5454cacf000fc8134c","ref":"","in":"header","required":false,"desc":"","default":"\"Bearer <token>\"","type":"string","name":"Authorization"}],"results":{"codes":[{"name":"","code":"{\n  \"task_id\": 1,\n  \"campaign_id\": 12,\n  \"phone_number\": \"+918743970440\",\n  \"meta\": {\n    \"order_name\": \"Denim Jeans\"\n  },\n  \"contact_name\": \"John Doe\"\n}","language":"json","status":201},{"code":"{\n\t\"phone_number\": [\n\t\t\"This field is required.\"\n\t],\n\t\"meta\": [\n\t\t\"This field is required.\"\n\t],\n\t\"task_id\": [\n\t\t\"This field is required.\"\n\t],\n\t\"campaign_id\": [\n\t\t\"This field is required.\"\n\t]\n}","language":"json","status":400,"name":"Fields missing"},{"code":"{\n\t\"non_field_errors\": [\n\t\t\"The field task_id must be unique for this integration.\"\n\t]\n}","language":"json","status":400,"name":"Duplicate task_id"},{"status":403,"name":"wrong campaign_id","language":"json","code":"{\n\t\"non_field_errors\": [\n\t\t\"Wrong campaign id used. Please contact business@squadrun.co.\"\n\t]\n}"}]},"settings":"","url":"/biz/api/voice/task/"},"hidden":false,"next":{"pages":[],"description":""},"updates":["5a0a8faa3e1ca000309967d1"],"version":"5b0e6faab7156300039cbccd","__v":9,"link_external":false,"link_url":"","project":"5474cf1d59fade080004ca59","sync_unique":"","title":"/biz/api/voice/task/","type":"post","user":"5474ce9d4f95ac0800481503","category":"5b0e6faab7156300039cbcbf","childrenPages":[]}

post/biz/api/voice/task/

This API is used to push new tasks for a particular campaign on SquadVoice Platform.

Body Params

task_id:
required
integer
A unique id of the data point. This acts as a unique transaction id for reference in the responses API and the callback/webhook
campaign_id:
required
integer
A unique id for the calling campaign
phone_number:
required
string
Phone number to which we need contact in order to complete the given task.
meta:
required
object
A JSON dump of the data that will contain relevant key values as per your use case.
contact_name:
string
Name of the contact for caller to refer receiver by. Max 48 chars.

Headers

Content-Type:
string"application/json"
Authorization:
string"Bearer <token>"
[block:callout] { "type": "success", "title": "Data security", "body": "Goes without saying your data is secure with us. :)\n\nWe call our tele callers via a masked number. This way the `phone_number` you share with us is never shared with our tele callers." } [/block] **Multiple tasks per /biz/api/voice/task/ API call** Sample request payload wth multiple tasks per request. You'll receive an identical response in case of success. [block:code] { "codes": [ { "code": "[\n {\n \"task_id\": 5216,\n \"campaign_id\": 12,\n \"phone_number\": \"+918743970440\",\n \"meta\":\n {\n \"order_name\" : \"Blue Jeans\",\n \"order_id\": 137691334,\n },\n \"contact_name\": \"John Smith\"\n },\n {\n \"task_id\": 5215,\n \"campaign_id\": 12,\n \"phone_number\": \"+918743970445\",\n \"meta\":\n {\n \"order_name\" : \"Black Jeans\",\n \"order_id\": 137673874,\n },\n \"contact_name\": \"John Doe\"\n }\n]", "language": "json", "name": "Sample request payload" }, { "code": "[\n {\n \"task_id\": 5216,\n \"campaign_id\": 12,\n \"phone_number\": \"+918743970440\",\n \"meta\":\n {\n \"order_name\" : \"Blue Jeans\",\n \"order_id\": 137691334,\n },\n \"contact_name\": \"John Smith\"\n },\n {\n \"task_id\": 5215,\n \"campaign_id\": 12,\n \"phone_number\": \"+918743970445\",\n \"meta\":\n {\n \"order_name\" : \"Black Jeans\",\n \"order_id\": 137673874,\n },\n \"contact_name\": \"John Doe\"\n }\n]", "language": "json", "name": "201 - Sucess response" } ] } [/block] [block:api-header] { "type": "basic", "title": "Error Responses" } [/block] *Require fields are missing* When not all required keys are given, the error response is similar to [block:code] { "codes": [ { "code": "{\n\t\"phone_number\": [\n\t\t\"This field is required.\"\n\t],\n\t\"meta\": [\n\t\t\"This field is required.\"\n\t],\n\t\"task_id\": [\n\t\t\"This field is required.\"\n\t],\n\t\"campaign_id\": [\n\t\t\"This field is required.\"\n\t]\n}", "language": "json", "name": "400 - Required fields missing" }, { "code": "HTTP/1.0 400 Bad Request\nAllow: POST, OPTIONS\nContent-Type: application/json", "language": "text", "name": "headers" } ] } [/block] **When the task already exists** This error occurs when this `task_id` has been used already. It might even be possible that the task with given id has been inserted before. [block:code] { "codes": [ { "code": "{\n\t\"non_field_errors\": [\n\t\t\"The field task_id must be unique for this integration.\"\n\t]\n}", "language": "json", "name": "400 - duplicate task_id" } ] } [/block]

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:callout] { "type": "success", "title": "Data security", "body": "Goes without saying your data is secure with us. :)\n\nWe call our tele callers via a masked number. This way the `phone_number` you share with us is never shared with our tele callers." } [/block] **Multiple tasks per /biz/api/voice/task/ API call** Sample request payload wth multiple tasks per request. You'll receive an identical response in case of success. [block:code] { "codes": [ { "code": "[\n {\n \"task_id\": 5216,\n \"campaign_id\": 12,\n \"phone_number\": \"+918743970440\",\n \"meta\":\n {\n \"order_name\" : \"Blue Jeans\",\n \"order_id\": 137691334,\n },\n \"contact_name\": \"John Smith\"\n },\n {\n \"task_id\": 5215,\n \"campaign_id\": 12,\n \"phone_number\": \"+918743970445\",\n \"meta\":\n {\n \"order_name\" : \"Black Jeans\",\n \"order_id\": 137673874,\n },\n \"contact_name\": \"John Doe\"\n }\n]", "language": "json", "name": "Sample request payload" }, { "code": "[\n {\n \"task_id\": 5216,\n \"campaign_id\": 12,\n \"phone_number\": \"+918743970440\",\n \"meta\":\n {\n \"order_name\" : \"Blue Jeans\",\n \"order_id\": 137691334,\n },\n \"contact_name\": \"John Smith\"\n },\n {\n \"task_id\": 5215,\n \"campaign_id\": 12,\n \"phone_number\": \"+918743970445\",\n \"meta\":\n {\n \"order_name\" : \"Black Jeans\",\n \"order_id\": 137673874,\n },\n \"contact_name\": \"John Doe\"\n }\n]", "language": "json", "name": "201 - Sucess response" } ] } [/block] [block:api-header] { "type": "basic", "title": "Error Responses" } [/block] *Require fields are missing* When not all required keys are given, the error response is similar to [block:code] { "codes": [ { "code": "{\n\t\"phone_number\": [\n\t\t\"This field is required.\"\n\t],\n\t\"meta\": [\n\t\t\"This field is required.\"\n\t],\n\t\"task_id\": [\n\t\t\"This field is required.\"\n\t],\n\t\"campaign_id\": [\n\t\t\"This field is required.\"\n\t]\n}", "language": "json", "name": "400 - Required fields missing" }, { "code": "HTTP/1.0 400 Bad Request\nAllow: POST, OPTIONS\nContent-Type: application/json", "language": "text", "name": "headers" } ] } [/block] **When the task already exists** This error occurs when this `task_id` has been used already. It might even be possible that the task with given id has been inserted before. [block:code] { "codes": [ { "code": "{\n\t\"non_field_errors\": [\n\t\t\"The field task_id must be unique for this integration.\"\n\t]\n}", "language": "json", "name": "400 - duplicate task_id" } ] } [/block]
{"_id":"5b0e6faab7156300039cbcc8","type":"get","updates":[],"category":"5b0e6faab7156300039cbcbf","excerpt":"Get data of calls occurred between particular time intervals on SquadVoice platform","githubsync":"","isReference":false,"slug":"voiceapiresponses","project":"5474cf1d59fade080004ca59","__v":7,"createdAt":"2016-11-23T11:23:46.288Z","hidden":false,"next":{"pages":[],"description":""},"order":1,"parentDoc":null,"body":"The request to this endpoint returns a paginated response.\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"count\\\": 1,\\n  \\\"next\\\": null,\\n  \\\"previous\\\": null,\\n  \\\"results\\\": [\\n    {\\n      \\\"task_id\\\": 8,\\n      \\\"contact_name\\\": \\\"John Smith\\\",\\n      \\\"phone_number\\\": \\\"+919512345678\\\",\\n      \\\"meta\\\": {\\n        \\\"order_id\\\": 127812,\\n        \\\"order_name\\\": \\\"Denim Jeans\\\"\\n      },\\n      \\\"completed_at\\\": 1479992291000,\\n      \\\"call_attempts\\\": [\\n        {\\n          \\\"recording_url\\\": null,\\n          \\\"called_at\\\": 1479992221000,\\n          \\\"answers\\\": {},\\n          \\\"call_duration\\\": 10,\\n          \\\"outcome\\\": \\\"Abruptly Disconnected and Not Receiving\\\",\\n          \\\"is_attempt_final\\\": false,\\n          \\\"player_mission_ref_id\\\": \\\"ABCD123\\\"\\n        },\\n        {\\n          \\\"recording_url\\\": \\\"https://s3-ap-southeast-1.amazonaws.com/squadrun/squadrun/dummy.mp3\\\",\\n          \\\"called_at\\\": 1479992291000,\\n          \\\"answers\\\": {\\n            \\\"age\\\": 23,\\n            \\\"was_puchase_done\\\": \\\"Yes\\\",\\n            \\\"order_received_on_time\\\": \\\"Yes\\\"\\n          },\\n          \\\"call_duration\\\": 100,\\n          \\\"outcome\\\": \\\"Survey Completed!\\\",\\n          \\\"is_attempt_final\\\": true,\\n          \\\"player_mission_ref_id\\\": \\\"EFGH123\\\"\\n        }\\n      ]\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n**Different fields arriving as part of response of `/biz/api/voice/responses/` means** \n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Key\",\n    \"0-0\": \"`contact_name`\",\n    \"h-1\": \"Explanation\",\n    \"h-2\": \"Data type\",\n    \"0-2\": \"String\",\n    \"0-1\": \"`contact_name` shared with us via `/biz/api/voice/task/` endpoint\",\n    \"1-0\": \"`phone_number`\",\n    \"1-1\": \"`phone_number` shared with us via `/biz/api/voice/task/` endpoint\",\n    \"1-2\": \"String\",\n    \"2-0\": \"`meta`\",\n    \"2-1\": \"meta data shared with us via `/biz/api/voice/task/` endpoint\",\n    \"2-2\": \"JSON\",\n    \"3-0\": \"`task_id`\",\n    \"3-1\": \"meta data shared with us via `/biz/api/voice/task/` endpoint\",\n    \"3-2\": \"Integer\",\n    \"4-0\": \"`completed_at`\",\n    \"4-2\": \"Timestamp\",\n    \"4-1\": \"Epoch timestamp at which the call task was completely executed.\",\n    \"5-0\": \"`call_attempts`\",\n    \"5-1\": \"List of call attempts that were done for related `task_id`\",\n    \"5-2\": \"Array of JSON\"\n  },\n  \"cols\": 3,\n  \"rows\": 6\n}\n[/block]\nwhere each `\"call_attempts\"` object has the following keys:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Key\",\n    \"h-1\": \"Explanation\",\n    \"h-2\": \"Data type\",\n    \"2-0\": \"`answers`\",\n    \"2-1\": \"Map of key-value pair, where both keys and values are of string type.\\nKey denotes identifier for the question asked, while value denotes respective answer.\",\n    \"2-2\": \"JSON\",\n    \"1-0\": \"`called_at`\",\n    \"1-1\": \"Epoch timestamp at which the call attempt was made.\",\n    \"1-2\": \"Timestamp\",\n    \"0-0\": \"`recording_url`\",\n    \"0-1\": \"An URL containing audio recording of the call happened for this attempt.\",\n    \"0-2\": \"String\",\n    \"3-0\": \"`outcome`\",\n    \"3-1\": \"This value denotes the business output from the call attempt made.\",\n    \"3-2\": \"String\",\n    \"4-0\": \"`is_attempt_final`\",\n    \"4-1\": \"Flag denoting whether this call attempt was final one for the task and no more call_attempts were made after this.\",\n    \"4-2\": \"Boolean\",\n    \"5-0\": \"`call_duration`\",\n    \"5-1\": \"Duration of the call happened for this attempt.\",\n    \"5-2\": \"Integer\",\n    \"6-0\": \"`player_mission_ref_id`\",\n    \"6-1\": \"Unique reference ID for that call attempt\",\n    \"6-2\": \"String\"\n  },\n  \"cols\": 3,\n  \"rows\": 7\n}\n[/block]","link_external":false,"link_url":"","sync_unique":"","title":"/biz/api/voice/responses/","api":{"url":"/biz/api/voice/responses/","auth":"required","examples":{"codes":[{"name":"","code":"curl -H \"Authorization: Bearer test_token\" -X GET \"https://app.squadrun.co/biz/api/voice/responses/?campaign_id=51&min_called_at=1479973282000&task_id=8\"","language":"curl"},{"language":"python","code":"import requests\n\nurl = \"https://app.squadrun.co/biz/api/voice/responses/\"\nheaders = {\"Authorization\": \"Bearer test_token\"}\nparams = {\"campaign_id\": 651, \"min_called_at\": 1479973282000, \"task_id\": 8}\n\nresponse = requests.get(url, params=params, headers=headers)\nresponse.json()"}]},"method":"get","params":[{"_id":"58381c73a814cf190089299c","ref":"","in":"query","required":true,"desc":"A unique id that will be provided","default":"","type":"int","name":"campaign_id"},{"_id":"55cc7ef5442f570d0032e7bf","ref":"","in":"query","required":false,"desc":"page number to return","default":"","type":"int","name":"page"},{"_id":"55cc7e4c13551d0d00c070b0","ref":"","in":"query","required":false,"desc":"Number of responses to return per page","default":"","type":"int","name":"page_size"},{"_id":"55cd89271450350d006d862b","ref":"","in":"query","required":false,"desc":"Comma separated ids. e.g. id=1,2,4,5 where all responses corresponding to id 1,2,4 & 5 need to be fetched.","default":"","type":"string","name":"task_id"},{"_id":"5836f321f61b1d1b0013e0a8","ref":"","in":"query","required":false,"desc":"min epoch timestamp to fetch responses \"since\". (in ms)","default":"","type":"timestamp","name":"min_called_at"},{"_id":"5836f321f61b1d1b0013e0a7","ref":"","in":"query","required":false,"desc":"max epoch timestamp to fetch responses \"till\". (in ms)","default":"","type":"timestamp","name":"max_called_at"},{"_id":"59849b252d13830027c7e189","ref":"","in":"header","required":false,"desc":"","default":"\"application/json\"","type":"string","name":"Content-Type"},{"_id":"59849b252d13830027c7e188","ref":"","in":"header","required":false,"desc":"","default":"\"Bearer <token>\"","type":"string","name":"Authorization"}],"results":{"codes":[{"language":"json","status":200,"name":"","code":"{\n  \"count\": 1,\n  \"next\": null,\n  \"previous\": null,\n  \"results\": [\n    {\n      \"task_id\": 8,\n      \"contact_name\": \"John Smith\",\n      \"phone_number\": \"+919512345678\",\n      \"meta\": {\n        \"order_id\": 127812,\n        \"order_name\": \"Denim Jeans\"\n      },\n      \"completed_at\": 1479992291000,\n      \"call_attempts\": [\n        {\n          \"recording_url\": null,\n          \"called_at\": 1479992221000,\n          \"answers\": {},\n          \"call_duration\": 10,\n          \"outcome\": \"Abruptly Disconnected and Not Receiving\",\n          \"is_attempt_final\": false,\n          \"player_mission_ref_id\": \"ABCD123\"\n        },\n        {\n          \"recording_url\": \"https://s3-ap-southeast-1.amazonaws.com/squadrun/squadrun/dummy.mp3\",\n          \"called_at\": 1479992291000,\n          \"answers\": {\n            \"age\": 23,\n            \"was_puchase_done\": \"Yes\",\n            \"order_received_on_time\": \"Yes\"\n          },\n          \"call_duration\": 100,\n          \"outcome\": \"Survey Completed!\",\n          \"is_attempt_final\": true,\n          \"player_mission_ref_id\": \"EFGH123\"\n        }\n      ]\n    }\n  ]\n}"}]},"settings":""},"user":"5474ce9d4f95ac0800481503","version":"5b0e6faab7156300039cbccd","childrenPages":[]}

get/biz/api/voice/responses/

Get data of calls occurred between particular time intervals on SquadVoice platform

Query Params

campaign_id:
required
integer
A unique id that will be provided
page:
integer
page number to return
page_size:
integer
Number of responses to return per page
task_id:
string
Comma separated ids. e.g. id=1,2,4,5 where all responses corresponding to id 1,2,4 & 5 need to be fetched.
min_called_at:
timestamp
min epoch timestamp to fetch responses "since". (in ms)
max_called_at:
timestamp
max epoch timestamp to fetch responses "till". (in ms)

Headers

Content-Type:
string"application/json"
Authorization:
string"Bearer <token>"
The request to this endpoint returns a paginated response. [block:code] { "codes": [ { "code": "{\n \"count\": 1,\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"task_id\": 8,\n \"contact_name\": \"John Smith\",\n \"phone_number\": \"+919512345678\",\n \"meta\": {\n \"order_id\": 127812,\n \"order_name\": \"Denim Jeans\"\n },\n \"completed_at\": 1479992291000,\n \"call_attempts\": [\n {\n \"recording_url\": null,\n \"called_at\": 1479992221000,\n \"answers\": {},\n \"call_duration\": 10,\n \"outcome\": \"Abruptly Disconnected and Not Receiving\",\n \"is_attempt_final\": false,\n \"player_mission_ref_id\": \"ABCD123\"\n },\n {\n \"recording_url\": \"https://s3-ap-southeast-1.amazonaws.com/squadrun/squadrun/dummy.mp3\",\n \"called_at\": 1479992291000,\n \"answers\": {\n \"age\": 23,\n \"was_puchase_done\": \"Yes\",\n \"order_received_on_time\": \"Yes\"\n },\n \"call_duration\": 100,\n \"outcome\": \"Survey Completed!\",\n \"is_attempt_final\": true,\n \"player_mission_ref_id\": \"EFGH123\"\n }\n ]\n }\n ]\n}", "language": "json" } ] } [/block] **Different fields arriving as part of response of `/biz/api/voice/responses/` means** [block:parameters] { "data": { "h-0": "Key", "0-0": "`contact_name`", "h-1": "Explanation", "h-2": "Data type", "0-2": "String", "0-1": "`contact_name` shared with us via `/biz/api/voice/task/` endpoint", "1-0": "`phone_number`", "1-1": "`phone_number` shared with us via `/biz/api/voice/task/` endpoint", "1-2": "String", "2-0": "`meta`", "2-1": "meta data shared with us via `/biz/api/voice/task/` endpoint", "2-2": "JSON", "3-0": "`task_id`", "3-1": "meta data shared with us via `/biz/api/voice/task/` endpoint", "3-2": "Integer", "4-0": "`completed_at`", "4-2": "Timestamp", "4-1": "Epoch timestamp at which the call task was completely executed.", "5-0": "`call_attempts`", "5-1": "List of call attempts that were done for related `task_id`", "5-2": "Array of JSON" }, "cols": 3, "rows": 6 } [/block] where each `"call_attempts"` object has the following keys: [block:parameters] { "data": { "h-0": "Key", "h-1": "Explanation", "h-2": "Data type", "2-0": "`answers`", "2-1": "Map of key-value pair, where both keys and values are of string type.\nKey denotes identifier for the question asked, while value denotes respective answer.", "2-2": "JSON", "1-0": "`called_at`", "1-1": "Epoch timestamp at which the call attempt was made.", "1-2": "Timestamp", "0-0": "`recording_url`", "0-1": "An URL containing audio recording of the call happened for this attempt.", "0-2": "String", "3-0": "`outcome`", "3-1": "This value denotes the business output from the call attempt made.", "3-2": "String", "4-0": "`is_attempt_final`", "4-1": "Flag denoting whether this call attempt was final one for the task and no more call_attempts were made after this.", "4-2": "Boolean", "5-0": "`call_duration`", "5-1": "Duration of the call happened for this attempt.", "5-2": "Integer", "6-0": "`player_mission_ref_id`", "6-1": "Unique reference ID for that call attempt", "6-2": "String" }, "cols": 3, "rows": 7 } [/block]

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



The request to this endpoint returns a paginated response. [block:code] { "codes": [ { "code": "{\n \"count\": 1,\n \"next\": null,\n \"previous\": null,\n \"results\": [\n {\n \"task_id\": 8,\n \"contact_name\": \"John Smith\",\n \"phone_number\": \"+919512345678\",\n \"meta\": {\n \"order_id\": 127812,\n \"order_name\": \"Denim Jeans\"\n },\n \"completed_at\": 1479992291000,\n \"call_attempts\": [\n {\n \"recording_url\": null,\n \"called_at\": 1479992221000,\n \"answers\": {},\n \"call_duration\": 10,\n \"outcome\": \"Abruptly Disconnected and Not Receiving\",\n \"is_attempt_final\": false,\n \"player_mission_ref_id\": \"ABCD123\"\n },\n {\n \"recording_url\": \"https://s3-ap-southeast-1.amazonaws.com/squadrun/squadrun/dummy.mp3\",\n \"called_at\": 1479992291000,\n \"answers\": {\n \"age\": 23,\n \"was_puchase_done\": \"Yes\",\n \"order_received_on_time\": \"Yes\"\n },\n \"call_duration\": 100,\n \"outcome\": \"Survey Completed!\",\n \"is_attempt_final\": true,\n \"player_mission_ref_id\": \"EFGH123\"\n }\n ]\n }\n ]\n}", "language": "json" } ] } [/block] **Different fields arriving as part of response of `/biz/api/voice/responses/` means** [block:parameters] { "data": { "h-0": "Key", "0-0": "`contact_name`", "h-1": "Explanation", "h-2": "Data type", "0-2": "String", "0-1": "`contact_name` shared with us via `/biz/api/voice/task/` endpoint", "1-0": "`phone_number`", "1-1": "`phone_number` shared with us via `/biz/api/voice/task/` endpoint", "1-2": "String", "2-0": "`meta`", "2-1": "meta data shared with us via `/biz/api/voice/task/` endpoint", "2-2": "JSON", "3-0": "`task_id`", "3-1": "meta data shared with us via `/biz/api/voice/task/` endpoint", "3-2": "Integer", "4-0": "`completed_at`", "4-2": "Timestamp", "4-1": "Epoch timestamp at which the call task was completely executed.", "5-0": "`call_attempts`", "5-1": "List of call attempts that were done for related `task_id`", "5-2": "Array of JSON" }, "cols": 3, "rows": 6 } [/block] where each `"call_attempts"` object has the following keys: [block:parameters] { "data": { "h-0": "Key", "h-1": "Explanation", "h-2": "Data type", "2-0": "`answers`", "2-1": "Map of key-value pair, where both keys and values are of string type.\nKey denotes identifier for the question asked, while value denotes respective answer.", "2-2": "JSON", "1-0": "`called_at`", "1-1": "Epoch timestamp at which the call attempt was made.", "1-2": "Timestamp", "0-0": "`recording_url`", "0-1": "An URL containing audio recording of the call happened for this attempt.", "0-2": "String", "3-0": "`outcome`", "3-1": "This value denotes the business output from the call attempt made.", "3-2": "String", "4-0": "`is_attempt_final`", "4-1": "Flag denoting whether this call attempt was final one for the task and no more call_attempts were made after this.", "4-2": "Boolean", "5-0": "`call_duration`", "5-1": "Duration of the call happened for this attempt.", "5-2": "Integer", "6-0": "`player_mission_ref_id`", "6-1": "Unique reference ID for that call attempt", "6-2": "String" }, "cols": 3, "rows": 7 } [/block]
{"_id":"5b0e6faab7156300039cbcca","slug":"bizapiproject-nameitems","sync_unique":"","title":"/biz/api/v2/{project-name}/items/","__v":20,"category":"5b0e6faab7156300039cbcc1","updates":[],"body":"##  NOTE\nFollowing two details will be shared with you for the integration\n1. `{project-name}`: This is what forms the API endpoint.\n2. A set of **mandatory keys** that should be present inside the `data` object posted in the request.\n\n\n### Single Create\nThe following is a sample request payload. The response returned would contain the same data as sent.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"data\\\": {\\n\\t\\t\\\"Category\\\": \\\"Cars & Bikes\\\",\\n\\t\\t\\\"Description\\\": \\\"single owner less mileage driven nov 2009 no technical and mechanical work required 4 tyres and battery new driven by service class\\\",\\n\\t\\t\\\"Title\\\": \\\"Alto LXI nov 2009 excellent condition single owner\\\",\\n\\t\\t\\\"Brand\\\": \\\"Maruti Suzuki Alto\\\",\\n\\t\\t\\\"Phone\\\": 8800576985,\\n\\t\\t\\\"SubCategory\\\": \\\"Bikes\\\"\\n\\t},\\n\\t\\\"request_id\\\": \\\"example_1\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Request Payload\"\n    },\n    {\n      \"code\": \"{\\n\\t\\\"data\\\": {\\n\\t\\t\\\"Category\\\": \\\"Cars & Bikes\\\",\\n\\t\\t\\\"Description\\\": \\\"single owner less mileage driven nov 2009 no technical and mechanical work required 4 tyres and battery new driven by service class\\\",\\n\\t\\t\\\"Title\\\": \\\"Alto LXI nov 2009 excellent condition single owner\\\",\\n\\t\\t\\\"Brand\\\": \\\"Maruti Suzuki Alto\\\",\\n\\t\\t\\\"Phone\\\": 8800576985,\\n\\t\\t\\\"SubCategory\\\": \\\"Bikes\\\"\\n\\t},\\n\\t\\\"request_id\\\": \\\"example_1\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"201 - Success Response\"\n    }\n  ]\n}\n[/block]\n### Multiple Create\nThe following is a sample request payload. The response returned would contain the same data as sent.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[{\\n\\t\\\"data\\\": {\\n\\t\\t\\\"text\\\": \\\"first\\\"\\n\\t},\\n\\t\\\"request_id\\\": \\\"58216\\\"\\n}, {\\n\\t\\\"data\\\": {\\n\\t\\t\\\"text\\\": \\\"second\\\"\\n\\t},\\n\\t\\\"request_id\\\": \\\"58215\\\"\\n}]\",\n      \"language\": \"json\",\n      \"name\": \"Request Payload\"\n    },\n    {\n      \"code\": \"[{\\n\\t\\\"data\\\": {\\n\\t\\t\\\"text\\\": \\\"first\\\"\\n\\t},\\n\\t\\\"request_id\\\": \\\"58216\\\"\\n}, {\\n\\t\\\"data\\\": {\\n\\t\\t\\\"text\\\": \\\"second\\\"\\n\\t},\\n\\t\\\"request_id\\\": \\\"58215\\\"\\n}]\",\n      \"language\": \"json\",\n      \"name\": \"201 - Success Response\"\n    }\n  ]\n}\n[/block]","excerpt":"This API is used to push new items for the project","order":999,"project":"5474cf1d59fade080004ca59","user":"5474ce9d4f95ac0800481503","version":"5b0e6faab7156300039cbccd","api":{"examples":{"codes":[{"language":"python","code":"import requests\nimport json\n\n# project_name = squadrun-qc\nurl = \"https://api.squadplatform.com/biz/api/v2/squadrun-qc/items/\"\npayload = {\n  \"data\": {\"product_title\": \"api_example\"}, \n\t\"request_id\": \"example_1\"\n}\nheaders = {'Authorization': 'Bearer test_token', 'Content-Type': 'application/json'}\n\nrequests.post(url, json.dumps(payload), headers=headers)"},{"code":"# project_name = squadrun-qc\ncurl 'https://api.squadplatform.com/biz/api/v2/squadrun-qc/items/' \\\n-H 'Authorization: Bearer test_token' \\\n-H 'Content-Type: application/json' \\\n--data-binary $'{\"data\": {\"product_title\": \"api_example\"}, \"request_id\": \"example_1\"}'","language":"curl"},{"code":"import requests\nimport json\n\n# project_name = squadrun-qc\nurl = \"https://api.squadplatform.com/biz/api/v2/squadrun-qc/items/\"\npayload = [{\n  \"data\": {\"product_title\": \"api_example_1\"}, \n  \"request_id\": \"api_example_1\"\n},\n{\n  \"data\": {\"product_title\": \"api_example_2\"}, \n  \"request_id\": \"api_example_2\"\n}]\nheaders = {'Authorization': 'Bearer test_token', 'Content-Type': 'application/json'}\n\nrequests.post(url, json.dumps(payload), headers=headers)","language":"python","name":"python-multiple"}]},"method":"post","params":[{"_id":"58d14ebbc0971339005abc22","ref":"","in":"body","required":true,"desc":"A JSON dump of the data to be published. The JSON should contain all the mandatory keys as specified during the time of integration.","default":"","type":"object","name":"data"},{"_id":"58d14ebbc0971339005abc21","ref":"","in":"body","required":true,"desc":"An unique ID for the item. Maximum allowed length is 64 chars","default":"","type":"string","name":"request_id"},{"_id":"58d14ebbc0971339005abc20","ref":"","in":"header","required":true,"desc":"","default":"\"application/json\"","type":"string","name":"Content-Type"},{"_id":"58d14ebbc0971339005abc1f","ref":"","in":"header","required":true,"desc":"","default":"\"Bearer <token>\"","type":"string","name":"Authorization"}],"results":{"codes":[{"name":"","code":"{\n  \"data\": {\"product_title\":\"api_example\"},\n  \"request_id\": \"example_1\",\n}","language":"json","status":201},{"name":"Unique request_id","code":"{\n  \"non_field_errors\": [\n    \"The field request_id must be unique for this project.\"\n  ]\n}","language":"json","status":400},{"code":"[\n  {\n    \"non_field_errors\": [\n      \"The keys `product_title` were missing in `data`.\"\n    ]\n  }\n]","language":"json","status":400,"name":"Missing Mandatory Keys"},{"code":"{\n  \"error_type\": 0,\n  \"detail\": \"Authentication credentials were not provided.\"\n}","language":"json","status":401,"name":null},{"code":"{\n  \"request_id\": [\n    \"Ensure this field has no more than 64 characters.\"\n  ]\n}","language":"json","status":400},{"name":"Created (multiple)","status":201,"language":"json","code":"[{\n  \"data\": {\"product_title\": \"api_example_1\"}, \n  \"request_id\": \"api_example_1\"\n},\n{\n  \"data\": {\"product_title\": \"api_example_2\"}, \n  \"request_id\": \"api_example_2\"\n}]"}]},"settings":"5ad7100b2ebed80003920ee8","url":"/biz/api/v2/{project-name}/items/","auth":"required"},"createdAt":"2017-03-21T15:48:28.987Z","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","next":{"pages":[],"description":""},"type":"post","childrenPages":[]}

post/biz/api/v2/{project-name}/items/

This API is used to push new items for the project

Body Params

data:
required
object
A JSON dump of the data to be published. The JSON should contain all the mandatory keys as specified during the time of integration.
request_id:
required
string
An unique ID for the item. Maximum allowed length is 64 chars

Headers

Content-Type:
required
string"application/json"
Authorization:
required
string"Bearer <token>"
## NOTE Following two details will be shared with you for the integration 1. `{project-name}`: This is what forms the API endpoint. 2. A set of **mandatory keys** that should be present inside the `data` object posted in the request. ### Single Create The following is a sample request payload. The response returned would contain the same data as sent. [block:code] { "codes": [ { "code": "{\n\t\"data\": {\n\t\t\"Category\": \"Cars & Bikes\",\n\t\t\"Description\": \"single owner less mileage driven nov 2009 no technical and mechanical work required 4 tyres and battery new driven by service class\",\n\t\t\"Title\": \"Alto LXI nov 2009 excellent condition single owner\",\n\t\t\"Brand\": \"Maruti Suzuki Alto\",\n\t\t\"Phone\": 8800576985,\n\t\t\"SubCategory\": \"Bikes\"\n\t},\n\t\"request_id\": \"example_1\"\n}", "language": "json", "name": "Request Payload" }, { "code": "{\n\t\"data\": {\n\t\t\"Category\": \"Cars & Bikes\",\n\t\t\"Description\": \"single owner less mileage driven nov 2009 no technical and mechanical work required 4 tyres and battery new driven by service class\",\n\t\t\"Title\": \"Alto LXI nov 2009 excellent condition single owner\",\n\t\t\"Brand\": \"Maruti Suzuki Alto\",\n\t\t\"Phone\": 8800576985,\n\t\t\"SubCategory\": \"Bikes\"\n\t},\n\t\"request_id\": \"example_1\"\n}", "language": "json", "name": "201 - Success Response" } ] } [/block] ### Multiple Create The following is a sample request payload. The response returned would contain the same data as sent. [block:code] { "codes": [ { "code": "[{\n\t\"data\": {\n\t\t\"text\": \"first\"\n\t},\n\t\"request_id\": \"58216\"\n}, {\n\t\"data\": {\n\t\t\"text\": \"second\"\n\t},\n\t\"request_id\": \"58215\"\n}]", "language": "json", "name": "Request Payload" }, { "code": "[{\n\t\"data\": {\n\t\t\"text\": \"first\"\n\t},\n\t\"request_id\": \"58216\"\n}, {\n\t\"data\": {\n\t\t\"text\": \"second\"\n\t},\n\t\"request_id\": \"58215\"\n}]", "language": "json", "name": "201 - Success Response" } ] } [/block]

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



## NOTE Following two details will be shared with you for the integration 1. `{project-name}`: This is what forms the API endpoint. 2. A set of **mandatory keys** that should be present inside the `data` object posted in the request. ### Single Create The following is a sample request payload. The response returned would contain the same data as sent. [block:code] { "codes": [ { "code": "{\n\t\"data\": {\n\t\t\"Category\": \"Cars & Bikes\",\n\t\t\"Description\": \"single owner less mileage driven nov 2009 no technical and mechanical work required 4 tyres and battery new driven by service class\",\n\t\t\"Title\": \"Alto LXI nov 2009 excellent condition single owner\",\n\t\t\"Brand\": \"Maruti Suzuki Alto\",\n\t\t\"Phone\": 8800576985,\n\t\t\"SubCategory\": \"Bikes\"\n\t},\n\t\"request_id\": \"example_1\"\n}", "language": "json", "name": "Request Payload" }, { "code": "{\n\t\"data\": {\n\t\t\"Category\": \"Cars & Bikes\",\n\t\t\"Description\": \"single owner less mileage driven nov 2009 no technical and mechanical work required 4 tyres and battery new driven by service class\",\n\t\t\"Title\": \"Alto LXI nov 2009 excellent condition single owner\",\n\t\t\"Brand\": \"Maruti Suzuki Alto\",\n\t\t\"Phone\": 8800576985,\n\t\t\"SubCategory\": \"Bikes\"\n\t},\n\t\"request_id\": \"example_1\"\n}", "language": "json", "name": "201 - Success Response" } ] } [/block] ### Multiple Create The following is a sample request payload. The response returned would contain the same data as sent. [block:code] { "codes": [ { "code": "[{\n\t\"data\": {\n\t\t\"text\": \"first\"\n\t},\n\t\"request_id\": \"58216\"\n}, {\n\t\"data\": {\n\t\t\"text\": \"second\"\n\t},\n\t\"request_id\": \"58215\"\n}]", "language": "json", "name": "Request Payload" }, { "code": "[{\n\t\"data\": {\n\t\t\"text\": \"first\"\n\t},\n\t\"request_id\": \"58216\"\n}, {\n\t\"data\": {\n\t\t\"text\": \"second\"\n\t},\n\t\"request_id\": \"58215\"\n}]", "language": "json", "name": "201 - Success Response" } ] } [/block]
{"_id":"5b0e6faab7156300039cbccb","link_url":"","order":999,"project":"5474cf1d59fade080004ca59","title":"/biz/api/v2/{project-name}/responses/","body":"##  NOTE\nFollowing details will be shared with you for the integration\n1. `{project-name}`: This is what forms the API endpoint.\n2. Format for the `responses` that SquadRun will send for each item.\n\n## Response\nThe list of JSON containing `results` of the API Request has 4 datapoints:\n1. **request_id**: Unique id per project to identify an item, that was sent in the `/items/` API\n2. **data**: This is the `data` dump that was sent in the `/items/` API\n3. **judged_at**: This is the epoch timestamp in `milliseconds` at which the item received all responses and was ready to be sent\n4. **responses**: This field contains responses for the item. This varies based on the project requirements.","createdAt":"2017-03-21T16:49:02.345Z","link_external":false,"excerpt":"Get responses for Data Units","slug":"bizapiproject-nameresponses","type":"get","updates":[],"user":"5474ce9d4f95ac0800481503","__v":5,"category":"5b0e6faab7156300039cbcc1","version":"5b0e6faab7156300039cbccd","api":{"settings":"5ad7100b2ebed80003920ee8","url":"/biz/api/v2/{project-name}/responses/","auth":"required","examples":{"codes":[{"code":"import requests\n\n# project_name = squadrun-qc\nurl = \"https://api.squadplatform.com/biz/api/v2/squadrun-qc/responses/\"\nheaders = {\"Authorization\": \"Bearer test_token\"}\nparams = {\"min_judged_at\": 1490115295382, \"request_id\": \"1\"}\n\nresponse = requests.get(url, params=data, headers=headers)\nresponse.json()","language":"python"},{"code":"# project_name = squadrun-qc\ncurl -H \"Authorization: Bearer test_token\" -X GET \"https://api.squadplatform.com/biz/api/squadrun-qc/responses/min_judged_at=1490115295382&request_id=1\"","language":"curl"}]},"method":"get","params":[{"_id":"58d15b5e82bad51900a3cc86","ref":"","in":"query","required":false,"desc":"Comma separated request_ids. e.g. request_id=1,2,4,5 where all responses corresponding to request_id 1,2,4 & 5 need to be fetched.","default":"","type":"string","name":"request_id"},{"_id":"58d15b5e82bad51900a3cc85","ref":"","in":"query","required":false,"desc":"Minimum judged_at **epoch timestamp (milliseconds)**","default":"","type":"long","name":"min_judged_at"},{"_id":"58d15b5e82bad51900a3cc84","ref":"","in":"query","required":false,"desc":"Maximum judged_at **epoch timestamp (milliseconds)**","default":"","type":"long","name":"max_judged_at"},{"_id":"58d15b5e82bad51900a3cc83","ref":"","in":"query","required":false,"desc":"page number to return","default":"","type":"int","name":"page"},{"_id":"58d15b5e82bad51900a3cc82","ref":"","in":"query","required":false,"desc":"Number of items to return per page","default":"","type":"int","name":"page_size"},{"_id":"58d15db83c7b842f0056e5ad","ref":"","in":"header","required":true,"desc":"","default":"\"application/json\"","type":"string","name":"Content-Type"},{"_id":"58d15db83c7b842f0056e5ac","ref":"","in":"header","required":true,"desc":"","default":"\"Bearer <token>\"","type":"string","name":"Authorization"}],"results":{"codes":[{"code":"{\n  \"count\": 1,\n  \"next\": null,\n  \"previous\": null,\n  \"results\": [\n    {\n      \"data\": {\n        \"product_title\": \"api_example\n      },\n      \"responses\": {\n        \"test\": [\"response\"]\n      },\n      \"request_id\": 1,\n      \"judged_at\": 1490115295392\n    }\n  ]\n}","name":"","status":200,"language":"json"}]}},"hidden":false,"sync_unique":"","githubsync":"","isReference":false,"next":{"pages":[],"description":""},"childrenPages":[]}

get/biz/api/v2/{project-name}/responses/

Get responses for Data Units

Query Params

request_id:
string
Comma separated request_ids. e.g. request_id=1,2,4,5 where all responses corresponding to request_id 1,2,4 & 5 need to be fetched.
min_judged_at:
long
Minimum judged_at **epoch timestamp (milliseconds)**
max_judged_at:
long
Maximum judged_at **epoch timestamp (milliseconds)**
page:
integer
page number to return
page_size:
integer
Number of items to return per page

Headers

Content-Type:
required
string"application/json"
Authorization:
required
string"Bearer <token>"
## NOTE Following details will be shared with you for the integration 1. `{project-name}`: This is what forms the API endpoint. 2. Format for the `responses` that SquadRun will send for each item. ## Response The list of JSON containing `results` of the API Request has 4 datapoints: 1. **request_id**: Unique id per project to identify an item, that was sent in the `/items/` API 2. **data**: This is the `data` dump that was sent in the `/items/` API 3. **judged_at**: This is the epoch timestamp in `milliseconds` at which the item received all responses and was ready to be sent 4. **responses**: This field contains responses for the item. This varies based on the project requirements.

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



## NOTE Following details will be shared with you for the integration 1. `{project-name}`: This is what forms the API endpoint. 2. Format for the `responses` that SquadRun will send for each item. ## Response The list of JSON containing `results` of the API Request has 4 datapoints: 1. **request_id**: Unique id per project to identify an item, that was sent in the `/items/` API 2. **data**: This is the `data` dump that was sent in the `/items/` API 3. **judged_at**: This is the epoch timestamp in `milliseconds` at which the item received all responses and was ready to be sent 4. **responses**: This field contains responses for the item. This varies based on the project requirements.
{"_id":"5b0e6faab7156300039cbccc","project":"5474cf1d59fade080004ca59","version":"5b0e6faab7156300039cbccd","category":"5b0e6faab7156300039cbcc2","user":"5474ce9d4f95ac0800481503","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-08-10T12:57:46.719Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"{\n  \"task\": \"Draw Bounding Box around the food item\",\n  \"guideline\": \"Junk foods are bad for health, say no to them\",\n  \"email\": \"test_poc@squadrun.co\",\n  \"images\": [\n    \"https://upload.wikimedia.org/wikipedia/commons/2/2e/Fast_food_meal.jpg\"\n  ]\n}","language":"json","status":201},{"name":"","code":"{\n    \"email\": [\n        \"This field is required.\"\n    ],\n    \"guideline\": [\n        \"This field is required.\"\n    ]\n}","language":"json","status":400}]},"settings":"5ad7100b2ebed80003920ee8","auth":"required","params":[{"_id":"598c59d2f29110002d0bce93","ref":"","in":"body","required":false,"desc":"Piece of work to be assigned to SquadRun","default":"","type":"string","name":"task"},{"_id":"598c59d2f29110002d0bce92","ref":"","in":"body","required":true,"desc":"Instructions for doing the task","default":"","type":"string","name":"guideline"},{"_id":"598c59d2f29110002d0bce91","ref":"","in":"body","required":false,"desc":"Email of the point of contact for the guideline","default":"","type":"string","name":"email"},{"_id":"598c59d2f29110002d0bce90","ref":"","in":"body","required":false,"desc":"Array of Image URLs for the given guideline","default":"","type":"array_string","name":"images"},{"_id":"598c59d2f29110002d0bce8f","ref":"","in":"header","required":true,"desc":"","default":"application/json","type":"string","name":"Content-Type"},{"_id":"598c59d2f29110002d0bce8e","ref":"","in":"header","required":true,"desc":"","default":"Bearer <token>","type":"string","name":"Authorization"}],"url":"/biz/api/guidelines/","examples":{"codes":[{"code":"import requests\nimport json\n\nurl = \"https://api.squadplatform.com/biz/api/guidelines/\"\npayload = {\n  \"task\": \"Draw Bounding Box around the food item\",\n  \"guideline\": \"Junk foods are bad for health, say no to them\",\n  \"email\": \"test_poc@squadrun.co\",\n  \"images\": [\n    \"https://upload.wikimedia.org/wikipedia/commons/2/2e/Fast_food_meal.jpg\"\n  ]\n}\nheaders = {'Authorization': 'Bearer test_token', 'Content-Type': 'application/json'}\n\nrequests.post(url, json.dumps(payload), headers=headers)","language":"python"},{"code":"curl 'https://api.squadplatform.com/biz/api/guidelines/' \\\n-H 'Authorization: Bearer test_token' \\\n-H 'Content-Type: application/json' \\\n--data-binary $'{\n  \"task\": \"Draw Bounding Box around the food item\",\n  \"guideline\": \"Junk foods are bad for health, say no to them\",\n  \"email\": \"test_poc@squadrun.co\",\n  \"images\": [\n    \"https://upload.wikimedia.org/wikipedia/commons/2/2e/Fast_food_meal.jpg\"\n  ]\n}'","language":"curl"}]},"method":"post"},"isReference":false,"order":999,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"API is in Beta state\",\n  \"body\": \"This API endpoint is in Beta state right now and is subject to changes.\\nEven so, any changes to this API will be appropriately communicated.\"\n}\n[/block]\n### Single Create\nThe following is a sample request payload. The response returned would contain the same data as sent.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"email\\\": \\\"test_poc@squadrun.co\\\",\\n\\t\\\"guideline\\\": \\\"Junk foods are bad for health, say no to them\\\",\\n\\t\\\"task\\\": \\\"Disable junk\\\",\\n\\t\\\"images\\\": [\\\"https://upload.wikimedia.org/wikipedia/commons/2/2e/Fast_food_meal.jpg\\\"]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Request Payload\"\n    }\n  ]\n}\n[/block]\n\n### Multiple Create\nThe following is a sample request payload. The response returned would contain the same data as sent.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"email\\\": \\\"test_poc@squadrun.co\\\",\\n    \\\"guideline\\\": \\\"Junk foods are bad for health, say no to them\\\",\\n    \\\"task\\\": \\\"Disable junk\\\",\\n    \\\"images\\\": [\\\"https://upload.wikimedia.org/wikipedia/commons/2/2e/Fast_food_meal.jpg\\\"]\\n  },\\n  {\\n    \\\"email\\\": \\\"test_poc_2@squadrun.co\\\",\\n    \\\"guideline\\\": \\\"Junk foods are bad for health, say no to them\\\"\\n  }\\n]\",\n      \"language\": \"json\",\n      \"name\": \"Request Payload\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"bizapiproject-nameguidelines","type":"post","title":"/biz/api/guidelines/","__v":3,"childrenPages":[]}

post/biz/api/guidelines/


Body Params

task:
string
Piece of work to be assigned to SquadRun
guideline:
required
string
Instructions for doing the task
email:
string
Email of the point of contact for the guideline
images:
array of strings
Array of Image URLs for the given guideline

Headers

Content-Type:
required
stringapplication/json
Authorization:
required
stringBearer <token>
[block:callout] { "type": "info", "title": "API is in Beta state", "body": "This API endpoint is in Beta state right now and is subject to changes.\nEven so, any changes to this API will be appropriately communicated." } [/block] ### Single Create The following is a sample request payload. The response returned would contain the same data as sent. [block:code] { "codes": [ { "code": "{\n\t\"email\": \"test_poc@squadrun.co\",\n\t\"guideline\": \"Junk foods are bad for health, say no to them\",\n\t\"task\": \"Disable junk\",\n\t\"images\": [\"https://upload.wikimedia.org/wikipedia/commons/2/2e/Fast_food_meal.jpg\"]\n}", "language": "json", "name": "Request Payload" } ] } [/block] ### Multiple Create The following is a sample request payload. The response returned would contain the same data as sent. [block:code] { "codes": [ { "code": "[\n {\n \"email\": \"test_poc@squadrun.co\",\n \"guideline\": \"Junk foods are bad for health, say no to them\",\n \"task\": \"Disable junk\",\n \"images\": [\"https://upload.wikimedia.org/wikipedia/commons/2/2e/Fast_food_meal.jpg\"]\n },\n {\n \"email\": \"test_poc_2@squadrun.co\",\n \"guideline\": \"Junk foods are bad for health, say no to them\"\n }\n]", "language": "json", "name": "Request Payload" } ] } [/block]

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:callout] { "type": "info", "title": "API is in Beta state", "body": "This API endpoint is in Beta state right now and is subject to changes.\nEven so, any changes to this API will be appropriately communicated." } [/block] ### Single Create The following is a sample request payload. The response returned would contain the same data as sent. [block:code] { "codes": [ { "code": "{\n\t\"email\": \"test_poc@squadrun.co\",\n\t\"guideline\": \"Junk foods are bad for health, say no to them\",\n\t\"task\": \"Disable junk\",\n\t\"images\": [\"https://upload.wikimedia.org/wikipedia/commons/2/2e/Fast_food_meal.jpg\"]\n}", "language": "json", "name": "Request Payload" } ] } [/block] ### Multiple Create The following is a sample request payload. The response returned would contain the same data as sent. [block:code] { "codes": [ { "code": "[\n {\n \"email\": \"test_poc@squadrun.co\",\n \"guideline\": \"Junk foods are bad for health, say no to them\",\n \"task\": \"Disable junk\",\n \"images\": [\"https://upload.wikimedia.org/wikipedia/commons/2/2e/Fast_food_meal.jpg\"]\n },\n {\n \"email\": \"test_poc_2@squadrun.co\",\n \"guideline\": \"Junk foods are bad for health, say no to them\"\n }\n]", "language": "json", "name": "Request Payload" } ] } [/block]
{"_id":"5b1698173421d40003cbe546","project":"5474cf1d59fade080004ca59","version":"5b0e6faab7156300039cbccd","category":"5b1695fd0477b10003e987b9","user":"5474ce9d4f95ac0800481503","updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-06-05T14:03:03.946Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[{"_id":"5b169ec32b375a00039e0f50","ref":"","in":"body","required":false,"desc":"The `data` dump that was sent in the `/items/` API","default":"","type":"object","name":"data"},{"_id":"5b169ec32b375a00039e0f4f","ref":"","in":"body","required":false,"desc":"This field contains responses for the item. This varies based on the project requirements.","default":"","type":"object","name":"responses"},{"_id":"5b169ec32b375a00039e0f4e","ref":"","in":"body","required":false,"desc":"This is the epoch timestamp in `milliseconds` at which the item received all responses and was ready to be sent","default":"","type":"timestamp","name":"judged_at"},{"_id":"5b169ec32b375a00039e0f4d","ref":"","in":"body","required":false,"desc":"Unique id per project to identify an item, that was sent in the /items/ API.","default":"","type":"string","name":"request_id"},{"_id":"5b169ec32b375a00039e0f4c","ref":"","in":"header","required":false,"desc":"","default":"\"application/json\"","type":"string","name":"Content-Type"},{"_id":"5b169ec32b375a00039e0f4b","ref":"","in":"header","required":false,"desc":"","default":"Basic Base64_encoded_username_pass","type":"string","name":"Authorization"}],"url":"/your-custom-URL","examples":{"codes":[{"code":"{\n  \"data\": {\n    \"product_title\": \"api_example\"\n  },\n  \"responses\": {\n    \"test\": [\n      \"Judgement made by humans/AI\"\n    ]\n  },\n  \"judged_at\": 1528209296,\n  \"request_id\": \"1234\"\n}","language":"json","name":"payload structure"},{"code":"[\n  {\n    \"data\": {\n      \"product_title\": \"webhook\"\n    },\n    \"responses\": {\n      \"test\": [\n        \"Judgement by Human\"\n      ]\n    },\n    \"judged_at\": 1528209296,\n    \"request_id\": \"1234\"\n  },\n  {\n    \"data\": {\n      \"product_title\": \"webhook_2\"\n    },\n    \"responses\": {\n      \"test\": [\n        \"Judgement by another Human/AI\"\n      ]\n    },\n    \"judged_at\": 1528209297,\n    \"request_id\": \"1235\"\n  }\n]","language":"json","name":"payload - multiple responses"}]},"method":"post"},"isReference":false,"order":999,"body":"Instead of polling the [/biz/api/responses/](doc:bizapiresponses) API to see if your request id has been processed, you may opt to configure a callback URL that Squad will call once the processing is done. The API endpoint exposed by you must use `https` and can optionally be authenticated using `Basic Authentication`\n\n##  NOTE\nFollowing details will be shared with you for the integration\n1. Format for the `responses` that Squad will send for each item\n2. The API's URL and authentication parameters (if applicable) should be communicated to Squad during integration\n\n[block:api-header]\n{}\n[/block]","excerpt":"","slug":"webhooks","type":"post","title":"/your-custom-URL","__v":8,"childrenPages":[]}

post/your-custom-URL


Body Params

data:
object
The `data` dump that was sent in the `/items/` API
responses:
object
This field contains responses for the item. This varies based on the project requirements.
judged_at:
timestamp
This is the epoch timestamp in `milliseconds` at which the item received all responses and was ready to be sent
request_id:
string
Unique id per project to identify an item, that was sent in the /items/ API.

Headers

Content-Type:
string"application/json"
Authorization:
stringBasic Base64_encoded_username_pass
Instead of polling the [/biz/api/responses/](doc:bizapiresponses) API to see if your request id has been processed, you may opt to configure a callback URL that Squad will call once the processing is done. The API endpoint exposed by you must use `https` and can optionally be authenticated using `Basic Authentication` ## NOTE Following details will be shared with you for the integration 1. Format for the `responses` that Squad will send for each item 2. The API's URL and authentication parameters (if applicable) should be communicated to Squad during integration [block:api-header] {} [/block]

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



Instead of polling the [/biz/api/responses/](doc:bizapiresponses) API to see if your request id has been processed, you may opt to configure a callback URL that Squad will call once the processing is done. The API endpoint exposed by you must use `https` and can optionally be authenticated using `Basic Authentication` ## NOTE Following details will be shared with you for the integration 1. Format for the `responses` that Squad will send for each item 2. The API's URL and authentication parameters (if applicable) should be communicated to Squad during integration [block:api-header] {} [/block]
{"_id":"5b179104ac58100003e3cc5f","project":"5474cf1d59fade080004ca59","version":"5b0e6faab7156300039cbccd","category":"5b1695fd0477b10003e987b9","user":"5474ce9d4f95ac0800481503","updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-06-06T07:45:08.232Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"method":"get","examples":{"codes":[{"language":"curl","code":"curl -X GET \\\n  https://api.squadplatform.com/biz/api/test_project/webhook \\\n  -H 'Authorization: Bearer 1noXIBGTEsome_token7Q53M1tV' \\\n  -H 'Content-Type: application/json' \\"},{"language":"python","code":"import requests\n\nurl = \"https://api.squadplatform.com/biz/api/test_project/webhook\"\n\nheaders = {\n    'Authorization': \"Bearer 1noXIBGTEsome_token7Q53M1tV\",\n    'Content-Type': \"application/json\"\n    }\n\nresponse = requests.request(\"GET\", url, headers=headers)"}]},"results":{"codes":[{"status":200,"language":"json","code":"{\n    \"callback_url\": \"https://<your-custom-url>\"\n}","name":""},{"status":401,"language":"json","code":"{\n\t\"error_type\": 0,\n\t\"detail\": \"Authentication credentials were not provided.\"\n}","name":""},{"name":"no configured webhook","status":404,"language":"json","code":"{\n    \"error_type\": 1,\n    \"detail\": \"Not found.\"\n}"}]},"settings":"","auth":"required","params":[{"_id":"5b179104ac58100003e3cc60","ref":"","in":"header","required":false,"desc":"","default":"Bearer <token>","type":"string","name":"Authorization"}],"url":"/biz/api/{project_name}/webhook/"},"isReference":false,"order":999,"body":"## Note\n1. `project_name` will be shared with you for the integration\n2. Use the [/oauth/token/](doc:oauthtoken) API for getting the authorization token","excerpt":"Get details about the configured webhook for your project","slug":"bizapiproject_namewebhook","type":"get","title":"biz/api/{project_name}/webhook/","__v":5,"childrenPages":[]}

getbiz/api/{project_name}/webhook/

Get details about the configured webhook for your project

Headers

Authorization:
stringBearer <token>
## Note 1. `project_name` will be shared with you for the integration 2. Use the [/oauth/token/](doc:oauthtoken) API for getting the authorization token

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



## Note 1. `project_name` will be shared with you for the integration 2. Use the [/oauth/token/](doc:oauthtoken) API for getting the authorization token
{"_id":"5b179296ac58100003e3cc7b","project":"5474cf1d59fade080004ca59","version":"5b0e6faab7156300039cbccd","category":"5b1695fd0477b10003e987b9","user":"5474ce9d4f95ac0800481503","updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-06-06T07:51:50.556Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"method":"post","examples":{"codes":[{"language":"curl","code":"curl -X POST \\\n  https://api.squadplatform.com/biz/api/test_project/webhook \\\n  -H 'Authorization: Bearer 1noXIBGtokenLyJY0RbTqD7Q53MOtV' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n\t\"callback_url\": \"https://new_url/api\"\n}'"},{"language":"python","code":"import requests\n\nurl = \"https://api.squadplatform.com/biz/api/test_project/webhook\"\n\npayload = {'callback_url': 'https://new_url/api'}\nheaders = {\n    'Authorization': \"Bearer 1noXIBGtokenLyJY0RbTqD7Q53MOtV\",\n    'Content-Type': \"application/json\"\n    }\n\nresponse = requests.request(\"POST\", url, data=payload, headers=headers)"}]},"results":{"codes":[{"status":200,"language":"json","code":"{\n\t\"callback_url\": \"https://new_url/api\"\n}\n","name":""},{"status":401,"language":"json","code":"{\n\t\"error_type\": 0,\n\t\"detail\": \"Authentication credentials were not provided.\"\n}","name":""},{"name":"No configured webhook","status":404,"language":"json","code":"{\n    \"error_type\": 1,\n    \"detail\": \"Not found.\"\n}"},{"code":"{\n\t\t\"callback_url\": [\"Enter a valid URL.\"]\n}\n","language":"json","status":400,"name":"Invalid URL"},{"name":"Incorrect payload","status":400,"language":"json","code":"{\n\t\t\"callback_url\": [\"This field is required.\"]\n}\n"}]},"settings":"","auth":"required","params":[{"_id":"5b179296ac58100003e3cc7d","ref":"","in":"header","required":false,"desc":"","default":"application/json","type":"string","name":"Content-Type"},{"_id":"5b179296ac58100003e3cc7c","ref":"","in":"header","required":false,"desc":"","default":"Bearer <token>","type":"string","name":"Authorization"},{"_id":"5b17931409a73100038db27d","ref":"","in":"body","required":false,"desc":"The URL you want to set as the callback","default":"<new url>","type":"string","name":"callback_url"}],"url":"/biz/api/{project_name}/webhook/"},"isReference":false,"order":999,"body":"## Note\n1. `project_name` will be shared with you for the integration\n2. Use the [/oauth/token/](doc:oauthtoken) API for getting the authorization token","excerpt":"Update the URL of the webhook","slug":"bizapiproject_namewebhook-1","type":"post","title":"/biz/api/{project_name}/webhook/","__v":10,"childrenPages":[]}

post/biz/api/{project_name}/webhook/

Update the URL of the webhook

Body Params

callback_url:
string<new url>
The URL you want to set as the callback

Headers

Content-Type:
stringapplication/json
Authorization:
stringBearer <token>
## Note 1. `project_name` will be shared with you for the integration 2. Use the [/oauth/token/](doc:oauthtoken) API for getting the authorization token

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



## Note 1. `project_name` will be shared with you for the integration 2. Use the [/oauth/token/](doc:oauthtoken) API for getting the authorization token