{"__v":70,"_id":"573957a275724e0e00f2070f","category":{"__v":1,"_id":"548075cbe291c51a00e7e096","pages":["54807643e291c51a00e7e098"],"project":"542dbe0ecb19820800c1f4d7","version":"542ecc0a6b0eb6080066ca77","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-12-04T14:55:07.077Z","from_sync":false,"order":2,"slug":"overview","title":"REST API"},"parentDoc":null,"project":"542dbe0ecb19820800c1f4d7","user":"542dc547cb19820800c1f4f1","version":{"__v":29,"_id":"542ecc0a6b0eb6080066ca77","forked_from":"542dbe0fcb19820800c1f4da","project":"542dbe0ecb19820800c1f4d7","createdAt":"2014-10-03T16:17:14.165Z","releaseDate":"2014-10-03T16:17:14.165Z","categories":["542ecc0a6b0eb6080066ca78","542ef44f6b0eb6080066cb24","543bf3e22a30961a00b66eb3","5446952b82bd7e08002768a0","544821ae8d7af31a00dd41ce","544a7885f1aefa08006efc69","544c758e11845f0e001ed8de","544e5565b80812080035be55","544e558dbd51b9080037f8ca","5450b045a66f020800dba73d","5450eb6aa66f020800dba945","5450f39ea66f020800dba989","5450f877a66f020800dba9cf","54510356a66f020800dbaa17","5451274514af501a00b50c99","54513345a66f020800dbab24","54513cc014af501a00b50d24","54515eec14af501a00b50db9","54519b1d14af501a00b50ea9","54519b2aa66f020800dbacb4","54524f9704160008005b1d27","54538d2308d1800800473d95","54538d420c09721000a06a03","54538e5608d1800800473d9a","5453ea9547c30114004fb375","5453eb12b077c31c00067bcb","5453eb27b077c31c00067bcd","5453ed5db077c31c00067bde","548075cbe291c51a00e7e096"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-16T05:16:18.107Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"When you make a request to Zang, it will always return a response regarding the resources you have requested, created, or modified. These responses can be in a few different formats: XML, JSON, or CSV. \n\nWhen something goes wrong during a request, Zang responds with an HTTP status code. A message describing what went wrong and an error code and link to more information regarding the error. Below is an example of an exception response returned by Zang when a request is made with invalid credentials:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<Response>\\n<RestException> \\n  <Status>403</Status> \\n  <Message>Invalid credentials</Message>        \\n  <Code>10004</Code>\\n  <MoreInfo>http://www.zang.io/docs/api/rest/overview/errors/10004</MoreInfo>                      </RestException>\\n</Response>   \",\n      \"language\": \"xml\",\n      \"name\": \"XML Response\"\n    }\n  ]\n}\n[/block]\nBelow you'll find common status codes that may be returned with requests.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Status Code\",\n    \"h-1\": \"Response\",\n    \"0-0\": \"200 \\nOK\",\n    \"0-1\": \"The request was fulfilled successfully.\",\n    \"1-0\": \"201 \\nCreated\",\n    \"1-1\": \"The request was fulfilled successfully and a new resource was created.\",\n    \"2-0\": \"302 \\nFound\",\n    \"2-1\": \"The requested resource was found, but at a different location. GETing the provided URI in the location response header will redirect to the desired resource.\",\n    \"3-0\": \"304 \\nNot Modified\",\n    \"3-1\": \"The cached version of the representation has not been changed since last request.\",\n    \"4-0\": \"400 \\nBad Request\",\n    \"4-1\": \"Request could not be fulfilled. Check the syntax of the request.\",\n    \"5-0\": \"403 \\nUnauthorized\",\n    \"5-1\": \"Invalid credentials. Check the AccountSid and AuthToken you provided with the request.\",\n    \"6-0\": \"404 \\nNot Found\",\n    \"6-1\": \"Server could not find the requested resource.\",\n    \"7-0\": \"405 \\nMethod Not Allowed\",\n    \"7-1\": \"The method used to make the request is not supported.\",\n    \"8-0\": \"429 \\nToo Many Requests\",\n    \"8-1\": \"The request rate has been exceeded for some resource.\",\n    \"9-0\": \"500 \\nServer Error\",\n    \"9-1\": \"Something went wrong on our end while fulfilling the request.\",\n    \"10-0\": \"503 \\nService Unavailable\",\n    \"10-1\": \"A temporary error occurred on our end while attempting to fulfill your request.\"\n  },\n  \"cols\": 2,\n  \"rows\": 11\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"XML Response\"\n}\n[/block]\nXML is the default format when returning responses from Zang. All responses are wrapped by the `<Response>` element. An example of a request to view a call resource with an XML response returned is below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://api.zang.io/v2/Accounts/{AccountSid}/Calls/{CallSid}\",\n      \"language\": \"http\",\n      \"name\": \"Request\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<Response>\\n\\t\\t<Call>\\n\\t\\t\\t<DateUpdated>Sun, 15 May 2016 17:29:13 -0000</DateUpdated>\\n\\t\\t\\t<ParentCallSid>{CallSid}</ParentCallSid>\\n\\t\\t\\t<Duration>7</Duration>\\n\\t\\t\\t<From>+12223334444</From>\\n\\t\\t\\t<To>+15556667777</To>\\n\\t\\t\\t<CallerIdBlocked>false</CallerIdBlocked>\\n\\t\\t\\t<AnsweredBy>nobody</AnsweredBy>\\n\\t\\t\\t<Sid>{CallSid}</Sid>\\n\\t\\t\\t<RecordingsCount></RecordingsCount>\\n\\t\\t\\t<Price>0.00</Price>\\n\\t\\t\\t<ApiVersion>v2</ApiVersion>\\n\\t\\t\\t<Status>canceled</Status>\\n\\t\\t\\t<Direction>outbound-dial</Direction>\\n\\t\\t\\t<StartTime>Sun, 15 May 2016 17:29:06 -0000</StartTime>\\n\\t\\t\\t<DateCreated>Sun, 15 May 2016 17:29:06 -0000</DateCreated>\\n\\t\\t\\t<SubresourceUris>\\n        <Notifications>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Notifications</Notifications>\\n\\t\\t\\t\\t<Recordings>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Recordings</Recordings>\\n\\t\\t\\t</SubresourceUris>\\n\\t\\t\\t<ForwardedFrom></ForwardedFrom>\\n\\t\\t\\t<Uri>/v2/Accounts/{AccountSid}/Calls/{CallSid}</Uri>\\n\\t\\t\\t<AccountSid>{AccountSid}</AccountSid>\\n\\t\\t\\t<DurationBilled>0</DurationBilled>\\n\\t\\t\\t<EndTime>Sun, 15 May 2016 17:29:13 -0000</EndTime>\\n\\t\\t\\t<PhoneNumberSid></PhoneNumberSid>\\n\\t\\t</Call>\\n</Response>\",\n      \"language\": \"xml\",\n      \"name\": \"XML Response\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"JSON Response\"\n}\n[/block]\nTo enable a JSON response, simply apply .json to the end of the request URL. Elements within a JSON response are lowercase and separated by an underscore. An example of a request to view a call resource with a JSON response returned is below. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://api.zang.io/v2/Accounts/{AccountSid}/Calls/{CallSid}.json\",\n      \"language\": \"http\",\n      \"name\": \"Request\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"date_updated\\\": \\\"Sun, 15 May 2016 17:29:13 -0000\\\",\\n\\t\\\"parent_call_sid\\\": \\\"{CallSid}\\\",\\n\\t\\\"duration\\\": 7,\\n\\t\\\"from\\\": \\\"+12223334444\\\",\\n\\t\\\"to\\\": \\\"+15556667777\\\",\\n\\t\\\"caller_id_blocked\\\": \\\"false\\\",\\n\\t\\\"answered_by\\\": \\\"nobody\\\",\\n\\t\\\"sid\\\": \\\"{CallSid}\\\",\\n\\t\\\"recordings_count\\\": \\\"\\\",\\n\\t\\\"price\\\": \\\"0.00\\\",\\n\\t\\\"api_version\\\": \\\"v2\\\",\\n\\t\\\"status\\\": \\\"canceled\\\",\\n\\t\\\"direction\\\": \\\"outbound-dial\\\",\\n\\t\\\"start_time\\\": \\\"Sun, 15 May 2016 17:29:06 -0000\\\",\\n\\t\\\"date_created\\\": \\\"Sun, 15 May 2016 17:29:06 -0000\\\",\\n\\t\\\"subresource_uris\\\": {\\n\\t\\t\\\"notifications\\\": \\\"/v2/Accounts/{AccountSid}/Calls/{CallSid}/Notifications\\\",\\n\\t\\t\\\"recordings\\\": \\\"/v2/Accounts/{AccountSid}/Calls/{Callsid}/Recordings\\\"\\n\\t},\\n\\t\\\"forwarded_from\\\": \\\"\\\",\\n\\t\\\"uri\\\": \\\"/v2/Accounts/{AccountSid}/Calls/{Callsid}\\\",\\n\\t\\\"account_sid\\\": \\\"{AccountSid}\\\",\\n\\t\\\"duration_billed\\\": 0,\\n\\t\\\"end_time\\\": \\\"Sun, 15 May 2016 17:29:13 -0000\\\",\\n\\t\\\"phone_number_sid\\\": \\\"\\\"\\n}  \",\n      \"language\": \"json\",\n      \"name\": \"JSON Response\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"CSV Response\"\n}\n[/block]\nTo receive a CSV (Comma Separated Value) response, .csv can be appended at the end of your request URL. Data in a CSV format can be useful for easily displaying that information in spreadsheets. An example of a request to view a call list resource with a CSV response returned is below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://api.zang.io/v2/Accounts/{AccountSid}/Calls.csv\",\n      \"language\": \"http\",\n      \"name\": \"Request\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"date_updated,parent_call_sid,duration,from,to,caller_id_blocked,answered_by,sid,recordings_count,price,api_version,status,direction,start_time,date_created,subresource_uris,forwarded_from,uri,account_sid,duration_billed,end_time,phone_number_sid\\nSun, 15 May 2016 17:29:13 -0000,{CallSid},7,Unavailable,+12223334444,+15556667777,false,nobody,{CallSid},,0.00,v2,canceled,outbound-dial,Sun, 15 May 2016 17:29:06 -0000,Sun, 15 May 2016 17:29:06 -0000,{'notifications': u'/v2/Accounts/{AccountSid}/Calls/{CallSid}/Notifications', 'recordings': u'/v2/Accounts/{AccountSid}/Calls/{CallSid}/Recordings'},,/v2/Accounts/{AccountSid}/Calls/{CallSid},{AccountSid},,Sun, 15 May 2016 17:29:13 -0000,\",\n      \"language\": \"text\",\n      \"name\": \"CSV Response\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"Response Paging\"\n}\n[/block]\nRequests to Zang asking for lists will sometimes receive very large responses. To help with navigating through this data, Zang breaks larger responses up into pages and provides paging information in each response.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"page\",\n    \"0-1\": \"Current page being viewed. Paging is zero indexed so the first page starts with 0 instead of 1.\",\n    \"1-0\": \"pagesize\",\n    \"1-1\": \"The amount of items contained within a single page. Default is 50 items.\",\n    \"2-0\": \"numpages\",\n    \"2-1\": \"The number of pages used to return all of the items. This will vary depending on the pagesize.\",\n    \"3-0\": \"total\",\n    \"3-1\": \"The total amount of items returned in the response.\",\n    \"4-0\": \"start\",\n    \"4-1\": \"The overall position count of the first item in a page. Position counting starts at 0.\",\n    \"5-0\": \"end\",\n    \"5-1\": \"The overall position count of the last item in a page. For the first page, end would be 49 if the pagesize is 50.\",\n    \"6-0\": \"uri\",\n    \"6-1\": \"The Uniform Resource Identifier to the current page being viewed.\",\n    \"7-0\": \"firstpageuri\",\n    \"7-1\": \"The URI to the first page in the list.\",\n    \"8-0\": \"previouspageuri\",\n    \"8-1\": \"The URI to the previous page in the list.\",\n    \"9-0\": \"nextpageuri\",\n    \"9-1\": \"The URI to the next page in the list.\",\n    \"10-0\": \"lastpageuri\",\n    \"10-1\": \"The URI to the last page in the list.\"\n  },\n  \"cols\": 2,\n  \"rows\": 11\n}\n[/block]\nThe properties Page and PageSize can be used as CamelCased parameters during requests to designate that a particular page or pagesize should be returned. An example of the response returned when using these optional parameters is below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://api.zang.io/v2/Accounts/{AccountSid}/Calls/?Page=5&PageSize=2\",\n      \"language\": \"http\",\n      \"name\": \"Request\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<Response>\\n\\t\\t<Calls end=\\\"11\\\" firstpageuri=\\\"/v2/Accounts/{AccountSid}/Calls.xml?Page=0&amp;amp;PageSize=2\\\" lastpageuri=\\\"/v2/Accounts/{AccountSid}/Calls.xml?Page=189&amp;PageSize=2\\\" nextpageuri=\\\"/v2/Accounts/{AccountSid}/Calls.xml?Page=6&amp;amp;PageSize=2\\\" numpages=\\\"190\\\" page=\\\"5\\\" pagesize=\\\"2\\\" previouspageuri=\\\"/v2/Accounts/{AccountSid}/Calls.xml?Page=4&amp;amp;PageSize=2\\\" start=\\\"10\\\" total=\\\"379\\\" uri=\\\"/v2/Accounts/{AccountSid}/Calls.xml\\\">\\n\\t\\t\\t<Call>\\n\\t\\t\\t\\t<DateUpdated>Wed, 11 May 2016 22:34:54 -0000</DateUpdated>\\n\\t\\t\\t\\t<ParentCallSid>{CallSid}</ParentCallSid>\\n\\t\\t\\t\\t<Duration>37</Duration>\\n\\t\\t\\t\\t<From>+12223334444</From>\\n\\t\\t\\t\\t<To>+15556667777</To>\\n\\t\\t\\t\\t<CallerIdBlocked>false</CallerIdBlocked>\\n\\t\\t\\t\\t<AnsweredBy>nobody</AnsweredBy>\\n\\t\\t\\t\\t<Sid>{CallSid}</Sid>\\n\\t\\t\\t\\t<RecordingsCount></RecordingsCount>\\n\\t\\t\\t\\t<Price>0.0650</Price>\\n\\t\\t\\t\\t<ApiVersion>v2</ApiVersion>\\n\\t\\t\\t\\t<Status>completed</Status>\\n\\t\\t\\t\\t<Direction>outbound-dial</Direction>\\n\\t\\t\\t\\t<StartTime>Wed, 11 May 2016 22:34:17 -0000</StartTime>\\n\\t\\t\\t\\t<DateCreated>Wed, 11 May 2016 22:33:38 -0000</DateCreated>\\n\\t\\t\\t\\t<SubresourceUris>\\n\\t\\t\\t\\t\\t<Notifications>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Notifications</Notifications>\\n\\t\\t\\t\\t\\t<Recordings>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Recordings</Recordings>\\n\\t\\t\\t\\t</SubresourceUris>\\n\\t\\t\\t\\t<ForwardedFrom></ForwardedFrom>\\n\\t\\t\\t\\t<Uri>/v2/Accounts/{AccountSid}/Calls/{CallSid}</Uri>\\n\\t\\t\\t\\t<AccountSid>{AccountSid}</AccountSid>\\n\\t\\t\\t\\t<DurationBilled>60</DurationBilled>\\n\\t\\t\\t\\t<EndTime>Wed, 11 May 2016 22:34:54 -0000</EndTime>\\n\\t\\t\\t\\t<PhoneNumberSid></PhoneNumberSid>\\n\\t\\t\\t</Call>\\n\\t\\t\\t<Call>\\n\\t\\t\\t\\t<DateUpdated>Wed, 11 May 2016 22:34:54 -0000</DateUpdated>\\n\\t\\t\\t\\t<ParentCallSid></ParentCallSid>\\n\\t\\t\\t\\t<Duration>77</Duration>\\n\\t\\t\\t\\t<From>+12223334444</From>\\n\\t\\t\\t\\t<To>+15556667777</To>\\n\\t\\t\\t\\t<CallerIdBlocked>false</CallerIdBlocked>\\n\\t\\t\\t\\t<AnsweredBy>human</AnsweredBy>\\n\\t\\t\\t\\t<Sid>{CallSid}</Sid>\\n\\t\\t\\t\\t<RecordingsCount></RecordingsCount>\\n\\t\\t\\t\\t<Price>0.08</Price>\\n\\t\\t\\t\\t<ApiVersion>v2</ApiVersion>\\n\\t\\t\\t\\t<Status>completed</Status>\\n\\t\\t\\t\\t<Direction>outbound-api</Direction>\\n\\t\\t\\t\\t<StartTime>Wed, 11 May 2016 22:33:37 -0000</StartTime>\\n\\t\\t\\t\\t<DateCreated>Wed, 11 May 2016 22:33:26 -0000</DateCreated>\\n\\t\\t\\t\\t<SubresourceUris>\\n\\t\\t\\t\\t\\t<Notifications>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Notifications</Notifications>\\n\\t\\t\\t\\t\\t<Recordings>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Recordings</Recordings>\\n\\t\\t\\t\\t</SubresourceUris>\\n\\t\\t\\t\\t<ForwardedFrom></ForwardedFrom>\\n\\t\\t\\t\\t<Uri>/v2/Accounts/{AccountSid}/Calls/{CallSid}</Uri>\\n\\t\\t\\t\\t<AccountSid>{AccountSid}</AccountSid>\\n\\t\\t\\t\\t<DurationBilled>120</DurationBilled>\\n\\t\\t\\t\\t<EndTime>Wed, 11 May 2016 22:34:54 -0000</EndTime>\\n\\t\\t\\t\\t<PhoneNumberSid></PhoneNumberSid>\\n\\t\\t\\t</Call>\\n\\t\\t</Calls>\\n\\t</Response>\",\n      \"language\": \"xml\",\n      \"name\": \"Response\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"response-1","type":"basic","title":"Response"}
When you make a request to Zang, it will always return a response regarding the resources you have requested, created, or modified. These responses can be in a few different formats: XML, JSON, or CSV. When something goes wrong during a request, Zang responds with an HTTP status code. A message describing what went wrong and an error code and link to more information regarding the error. Below is an example of an exception response returned by Zang when a request is made with invalid credentials: [block:code] { "codes": [ { "code": "<Response>\n<RestException> \n <Status>403</Status> \n <Message>Invalid credentials</Message> \n <Code>10004</Code>\n <MoreInfo>http://www.zang.io/docs/api/rest/overview/errors/10004</MoreInfo> </RestException>\n</Response> ", "language": "xml", "name": "XML Response" } ] } [/block] Below you'll find common status codes that may be returned with requests. [block:parameters] { "data": { "h-0": "Status Code", "h-1": "Response", "0-0": "200 \nOK", "0-1": "The request was fulfilled successfully.", "1-0": "201 \nCreated", "1-1": "The request was fulfilled successfully and a new resource was created.", "2-0": "302 \nFound", "2-1": "The requested resource was found, but at a different location. GETing the provided URI in the location response header will redirect to the desired resource.", "3-0": "304 \nNot Modified", "3-1": "The cached version of the representation has not been changed since last request.", "4-0": "400 \nBad Request", "4-1": "Request could not be fulfilled. Check the syntax of the request.", "5-0": "403 \nUnauthorized", "5-1": "Invalid credentials. Check the AccountSid and AuthToken you provided with the request.", "6-0": "404 \nNot Found", "6-1": "Server could not find the requested resource.", "7-0": "405 \nMethod Not Allowed", "7-1": "The method used to make the request is not supported.", "8-0": "429 \nToo Many Requests", "8-1": "The request rate has been exceeded for some resource.", "9-0": "500 \nServer Error", "9-1": "Something went wrong on our end while fulfilling the request.", "10-0": "503 \nService Unavailable", "10-1": "A temporary error occurred on our end while attempting to fulfill your request." }, "cols": 2, "rows": 11 } [/block] [block:api-header] { "type": "get", "title": "XML Response" } [/block] XML is the default format when returning responses from Zang. All responses are wrapped by the `<Response>` element. An example of a request to view a call resource with an XML response returned is below. [block:code] { "codes": [ { "code": "https://api.zang.io/v2/Accounts/{AccountSid}/Calls/{CallSid}", "language": "http", "name": "Request" } ] } [/block] [block:code] { "codes": [ { "code": "<Response>\n\t\t<Call>\n\t\t\t<DateUpdated>Sun, 15 May 2016 17:29:13 -0000</DateUpdated>\n\t\t\t<ParentCallSid>{CallSid}</ParentCallSid>\n\t\t\t<Duration>7</Duration>\n\t\t\t<From>+12223334444</From>\n\t\t\t<To>+15556667777</To>\n\t\t\t<CallerIdBlocked>false</CallerIdBlocked>\n\t\t\t<AnsweredBy>nobody</AnsweredBy>\n\t\t\t<Sid>{CallSid}</Sid>\n\t\t\t<RecordingsCount></RecordingsCount>\n\t\t\t<Price>0.00</Price>\n\t\t\t<ApiVersion>v2</ApiVersion>\n\t\t\t<Status>canceled</Status>\n\t\t\t<Direction>outbound-dial</Direction>\n\t\t\t<StartTime>Sun, 15 May 2016 17:29:06 -0000</StartTime>\n\t\t\t<DateCreated>Sun, 15 May 2016 17:29:06 -0000</DateCreated>\n\t\t\t<SubresourceUris>\n <Notifications>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Notifications</Notifications>\n\t\t\t\t<Recordings>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Recordings</Recordings>\n\t\t\t</SubresourceUris>\n\t\t\t<ForwardedFrom></ForwardedFrom>\n\t\t\t<Uri>/v2/Accounts/{AccountSid}/Calls/{CallSid}</Uri>\n\t\t\t<AccountSid>{AccountSid}</AccountSid>\n\t\t\t<DurationBilled>0</DurationBilled>\n\t\t\t<EndTime>Sun, 15 May 2016 17:29:13 -0000</EndTime>\n\t\t\t<PhoneNumberSid></PhoneNumberSid>\n\t\t</Call>\n</Response>", "language": "xml", "name": "XML Response" } ] } [/block] [block:api-header] { "type": "get", "title": "JSON Response" } [/block] To enable a JSON response, simply apply .json to the end of the request URL. Elements within a JSON response are lowercase and separated by an underscore. An example of a request to view a call resource with a JSON response returned is below. [block:code] { "codes": [ { "code": "https://api.zang.io/v2/Accounts/{AccountSid}/Calls/{CallSid}.json", "language": "http", "name": "Request" } ] } [/block] [block:code] { "codes": [ { "code": "{\n\t\"date_updated\": \"Sun, 15 May 2016 17:29:13 -0000\",\n\t\"parent_call_sid\": \"{CallSid}\",\n\t\"duration\": 7,\n\t\"from\": \"+12223334444\",\n\t\"to\": \"+15556667777\",\n\t\"caller_id_blocked\": \"false\",\n\t\"answered_by\": \"nobody\",\n\t\"sid\": \"{CallSid}\",\n\t\"recordings_count\": \"\",\n\t\"price\": \"0.00\",\n\t\"api_version\": \"v2\",\n\t\"status\": \"canceled\",\n\t\"direction\": \"outbound-dial\",\n\t\"start_time\": \"Sun, 15 May 2016 17:29:06 -0000\",\n\t\"date_created\": \"Sun, 15 May 2016 17:29:06 -0000\",\n\t\"subresource_uris\": {\n\t\t\"notifications\": \"/v2/Accounts/{AccountSid}/Calls/{CallSid}/Notifications\",\n\t\t\"recordings\": \"/v2/Accounts/{AccountSid}/Calls/{Callsid}/Recordings\"\n\t},\n\t\"forwarded_from\": \"\",\n\t\"uri\": \"/v2/Accounts/{AccountSid}/Calls/{Callsid}\",\n\t\"account_sid\": \"{AccountSid}\",\n\t\"duration_billed\": 0,\n\t\"end_time\": \"Sun, 15 May 2016 17:29:13 -0000\",\n\t\"phone_number_sid\": \"\"\n} ", "language": "json", "name": "JSON Response" } ] } [/block] [block:api-header] { "type": "get", "title": "CSV Response" } [/block] To receive a CSV (Comma Separated Value) response, .csv can be appended at the end of your request URL. Data in a CSV format can be useful for easily displaying that information in spreadsheets. An example of a request to view a call list resource with a CSV response returned is below. [block:code] { "codes": [ { "code": "https://api.zang.io/v2/Accounts/{AccountSid}/Calls.csv", "language": "http", "name": "Request" } ] } [/block] [block:code] { "codes": [ { "code": "date_updated,parent_call_sid,duration,from,to,caller_id_blocked,answered_by,sid,recordings_count,price,api_version,status,direction,start_time,date_created,subresource_uris,forwarded_from,uri,account_sid,duration_billed,end_time,phone_number_sid\nSun, 15 May 2016 17:29:13 -0000,{CallSid},7,Unavailable,+12223334444,+15556667777,false,nobody,{CallSid},,0.00,v2,canceled,outbound-dial,Sun, 15 May 2016 17:29:06 -0000,Sun, 15 May 2016 17:29:06 -0000,{'notifications': u'/v2/Accounts/{AccountSid}/Calls/{CallSid}/Notifications', 'recordings': u'/v2/Accounts/{AccountSid}/Calls/{CallSid}/Recordings'},,/v2/Accounts/{AccountSid}/Calls/{CallSid},{AccountSid},,Sun, 15 May 2016 17:29:13 -0000,", "language": "text", "name": "CSV Response" } ] } [/block] [block:api-header] { "type": "get", "title": "Response Paging" } [/block] Requests to Zang asking for lists will sometimes receive very large responses. To help with navigating through this data, Zang breaks larger responses up into pages and provides paging information in each response. [block:parameters] { "data": { "h-0": "Property", "h-1": "Description", "0-0": "page", "0-1": "Current page being viewed. Paging is zero indexed so the first page starts with 0 instead of 1.", "1-0": "pagesize", "1-1": "The amount of items contained within a single page. Default is 50 items.", "2-0": "numpages", "2-1": "The number of pages used to return all of the items. This will vary depending on the pagesize.", "3-0": "total", "3-1": "The total amount of items returned in the response.", "4-0": "start", "4-1": "The overall position count of the first item in a page. Position counting starts at 0.", "5-0": "end", "5-1": "The overall position count of the last item in a page. For the first page, end would be 49 if the pagesize is 50.", "6-0": "uri", "6-1": "The Uniform Resource Identifier to the current page being viewed.", "7-0": "firstpageuri", "7-1": "The URI to the first page in the list.", "8-0": "previouspageuri", "8-1": "The URI to the previous page in the list.", "9-0": "nextpageuri", "9-1": "The URI to the next page in the list.", "10-0": "lastpageuri", "10-1": "The URI to the last page in the list." }, "cols": 2, "rows": 11 } [/block] The properties Page and PageSize can be used as CamelCased parameters during requests to designate that a particular page or pagesize should be returned. An example of the response returned when using these optional parameters is below. [block:code] { "codes": [ { "code": "https://api.zang.io/v2/Accounts/{AccountSid}/Calls/?Page=5&PageSize=2", "language": "http", "name": "Request" } ] } [/block] [block:code] { "codes": [ { "code": "<Response>\n\t\t<Calls end=\"11\" firstpageuri=\"/v2/Accounts/{AccountSid}/Calls.xml?Page=0&amp;amp;PageSize=2\" lastpageuri=\"/v2/Accounts/{AccountSid}/Calls.xml?Page=189&amp;PageSize=2\" nextpageuri=\"/v2/Accounts/{AccountSid}/Calls.xml?Page=6&amp;amp;PageSize=2\" numpages=\"190\" page=\"5\" pagesize=\"2\" previouspageuri=\"/v2/Accounts/{AccountSid}/Calls.xml?Page=4&amp;amp;PageSize=2\" start=\"10\" total=\"379\" uri=\"/v2/Accounts/{AccountSid}/Calls.xml\">\n\t\t\t<Call>\n\t\t\t\t<DateUpdated>Wed, 11 May 2016 22:34:54 -0000</DateUpdated>\n\t\t\t\t<ParentCallSid>{CallSid}</ParentCallSid>\n\t\t\t\t<Duration>37</Duration>\n\t\t\t\t<From>+12223334444</From>\n\t\t\t\t<To>+15556667777</To>\n\t\t\t\t<CallerIdBlocked>false</CallerIdBlocked>\n\t\t\t\t<AnsweredBy>nobody</AnsweredBy>\n\t\t\t\t<Sid>{CallSid}</Sid>\n\t\t\t\t<RecordingsCount></RecordingsCount>\n\t\t\t\t<Price>0.0650</Price>\n\t\t\t\t<ApiVersion>v2</ApiVersion>\n\t\t\t\t<Status>completed</Status>\n\t\t\t\t<Direction>outbound-dial</Direction>\n\t\t\t\t<StartTime>Wed, 11 May 2016 22:34:17 -0000</StartTime>\n\t\t\t\t<DateCreated>Wed, 11 May 2016 22:33:38 -0000</DateCreated>\n\t\t\t\t<SubresourceUris>\n\t\t\t\t\t<Notifications>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Notifications</Notifications>\n\t\t\t\t\t<Recordings>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Recordings</Recordings>\n\t\t\t\t</SubresourceUris>\n\t\t\t\t<ForwardedFrom></ForwardedFrom>\n\t\t\t\t<Uri>/v2/Accounts/{AccountSid}/Calls/{CallSid}</Uri>\n\t\t\t\t<AccountSid>{AccountSid}</AccountSid>\n\t\t\t\t<DurationBilled>60</DurationBilled>\n\t\t\t\t<EndTime>Wed, 11 May 2016 22:34:54 -0000</EndTime>\n\t\t\t\t<PhoneNumberSid></PhoneNumberSid>\n\t\t\t</Call>\n\t\t\t<Call>\n\t\t\t\t<DateUpdated>Wed, 11 May 2016 22:34:54 -0000</DateUpdated>\n\t\t\t\t<ParentCallSid></ParentCallSid>\n\t\t\t\t<Duration>77</Duration>\n\t\t\t\t<From>+12223334444</From>\n\t\t\t\t<To>+15556667777</To>\n\t\t\t\t<CallerIdBlocked>false</CallerIdBlocked>\n\t\t\t\t<AnsweredBy>human</AnsweredBy>\n\t\t\t\t<Sid>{CallSid}</Sid>\n\t\t\t\t<RecordingsCount></RecordingsCount>\n\t\t\t\t<Price>0.08</Price>\n\t\t\t\t<ApiVersion>v2</ApiVersion>\n\t\t\t\t<Status>completed</Status>\n\t\t\t\t<Direction>outbound-api</Direction>\n\t\t\t\t<StartTime>Wed, 11 May 2016 22:33:37 -0000</StartTime>\n\t\t\t\t<DateCreated>Wed, 11 May 2016 22:33:26 -0000</DateCreated>\n\t\t\t\t<SubresourceUris>\n\t\t\t\t\t<Notifications>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Notifications</Notifications>\n\t\t\t\t\t<Recordings>/v2/Accounts/{AccountSid}/Calls/{CallSid}/Recordings</Recordings>\n\t\t\t\t</SubresourceUris>\n\t\t\t\t<ForwardedFrom></ForwardedFrom>\n\t\t\t\t<Uri>/v2/Accounts/{AccountSid}/Calls/{CallSid}</Uri>\n\t\t\t\t<AccountSid>{AccountSid}</AccountSid>\n\t\t\t\t<DurationBilled>120</DurationBilled>\n\t\t\t\t<EndTime>Wed, 11 May 2016 22:34:54 -0000</EndTime>\n\t\t\t\t<PhoneNumberSid></PhoneNumberSid>\n\t\t\t</Call>\n\t\t</Calls>\n\t</Response>", "language": "xml", "name": "Response" } ] } [/block]