{"_id":"576d42354bcd290e0042895b","user":"56bc6af27c91881900089bac","category":{"_id":"576d42354bcd290e00428944","__v":0,"version":"576d42354bcd290e00428941","project":"56a526d4e7a1622b0024fae4","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-02-11T11:25:07.821Z","from_sync":false,"order":0,"slug":"objective-c","title":"Our API"},"editedParams":true,"__v":0,"editedParams2":true,"version":{"_id":"576d42354bcd290e00428941","project":"56a526d4e7a1622b0024fae4","__v":1,"createdAt":"2016-06-24T14:22:45.076Z","releaseDate":"2016-06-24T14:22:45.076Z","categories":["576d42354bcd290e00428942","576d42354bcd290e00428943","576d42354bcd290e00428944","576d42354bcd290e00428945","576d42354bcd290e00428946","576d42354bcd290e00428947"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"parentDoc":null,"project":"56a526d4e7a1622b0024fae4","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-11T15:41:03.691Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","method":"post","auth":"required","params":[{"_id":"56bcac4fb745dc0d00c1ee84","ref":"","in":"body","required":false,"desc":"An arbitrary JSON object that this chirp encapsulates.","default":"","type":"object","name":"data"},{"_id":"56bcac4fb745dc0d00c1ee85","ref":"","in":"body","required":false,"desc":"Set to false if the chirp should only be visible to your application. Defaults to true.","default":"true","type":"boolean","name":"public"}],"url":"/chirps"},"isReference":true,"order":5,"body":"[block:textarea]\n{\n  \"text\": \"## Request\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import requests\\n\\nurl = 'https://api.chirp.io/v1/chirps'\\nheaders = {\\n  'X-Auth-Token': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\\n}\\npayload = {\\n  'public': False,\\n  'data': {\\n    'example': True,\\n  },\\n}\\n\\nresponse = requests.post(url, headers=headers, json=payload)\",\n      \"language\": \"python\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n[block:textarea]\n{\n  \"text\": \"## Results\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"name\": 200,\n      \"code\": \"{\\n    \\\"longcode\\\": \\\"ssqd41cqh4152drjnj\\\",\\n    \\\"created_at\\\": \\\"2016-02-22T16:10:25.111000\\\",\\n    \\\"shortcode\\\": \\\"ssqd41cqh4\\\",\\n    \\\"public\\\": false,\\n    \\\"data\\\": {\\n        \\\"example\\\": true\\n    }\\n}\",\n      \"language\": \"json\",\n      \"status\": 200\n    },\n    {\n      \"name\": 400,\n      \"code\": \"{\\n    \\\"status\\\": 400,\\n    \\\"description\\\": \\\"Bad Request: Invalid parameter(s).\\\",\\n    \\\"error\\\": true\\n}\",\n      \"language\": \"json\",\n      \"status\": 400\n    },\n    {\n      \"code\": \"{\\n    \\\"status\\\": 401,\\n    \\\"description\\\": \\\"Unauthorized: Missing access token.\\\",\\n    \\\"error\\\": true\\n}\",\n      \"language\": \"json\",\n      \"status\": 401,\n      \"name\": 401\n    },\n    {\n      \"code\": \"{\\n    \\\"status\\\": 403,\\n    \\\"description\\\": \\\"Forbidden: Your token does not grant access to this resource.\\\",\\n    \\\"error\\\": true\\n}\",\n      \"language\": \"json\",\n      \"status\": 403,\n      \"name\": 403\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\nCreate a new chirp by passing an arbitrary JSON object, which is assigned a unique 10-character code that is ready to chirp.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"data\\\": {\\n    \\\"name\\\": \\\"kingfisher\\\",\\n    \\\"species\\\" : \\\"Alcedo atthis\\\",\\n    \\\"habitat\\\" : \\\"fresh-water\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Body\"\n    }\n  ]\n}\n[/block]\nThe return value assigns the data a unique `shortcode`, plus a `longcode` which includes error-correction characters that are needed for reliable audio transmission.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"longcode\\\": \\\"dcr4j9a2tm2q78em2t\\\",\\n  \\\"created_at\\\": \\\"2016-02-11T16:27:36.179000\\\",\\n  \\\"shortcode\\\": \\\"dcr4j9a2tm\\\",\\n  \\\"public\\\": true,\\n  \\\"data\\\": {\\n    \\\"name\\\": \\\"kingfisher\\\",\\n    \\\"species\\\" : \\\"Alcedo atthis\\\",\\n    \\\"habitat\\\" : \\\"fresh-water\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Return Value\"\n    }\n  ]\n}\n[/block]\nThis shortcode can then be passed directly to your platform-specific SDK to chirp the data. A receiving device can then query the API server for the matching shortcode, thus receiving the original payload.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[chirpShortcode::::at:::\\\"dcr4j9a2tm\\\" withCompletion:^(Chirp *chirp, NSError *error)\\n{\\n    if (!error)\\n        NSLog(@\\\"Chirped OK.\\\");\\n}]\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]","excerpt":"Create a chirp to encapsulate arbitrary JSON data.","slug":"api-post-chirp","type":"endpoint","title":"/chirps"}

post/chirps

Create a chirp to encapsulate arbitrary JSON data.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

data:
object
An arbitrary JSON object that this chirp encapsulates.
public:
booleantrue
Set to false if the chirp should only be visible to your application. Defaults to true.

Documentation

[block:textarea] { "text": "## Request", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "import requests\n\nurl = 'https://api.chirp.io/v1/chirps'\nheaders = {\n 'X-Auth-Token': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n}\npayload = {\n 'public': False,\n 'data': {\n 'example': True,\n },\n}\n\nresponse = requests.post(url, headers=headers, json=payload)", "language": "python" } ], "sidebar": true } [/block] [block:textarea] { "text": "## Results", "sidebar": true } [/block] [block:code] { "codes": [ { "name": 200, "code": "{\n \"longcode\": \"ssqd41cqh4152drjnj\",\n \"created_at\": \"2016-02-22T16:10:25.111000\",\n \"shortcode\": \"ssqd41cqh4\",\n \"public\": false,\n \"data\": {\n \"example\": true\n }\n}", "language": "json", "status": 200 }, { "name": 400, "code": "{\n \"status\": 400,\n \"description\": \"Bad Request: Invalid parameter(s).\",\n \"error\": true\n}", "language": "json", "status": 400 }, { "code": "{\n \"status\": 401,\n \"description\": \"Unauthorized: Missing access token.\",\n \"error\": true\n}", "language": "json", "status": 401, "name": 401 }, { "code": "{\n \"status\": 403,\n \"description\": \"Forbidden: Your token does not grant access to this resource.\",\n \"error\": true\n}", "language": "json", "status": 403, "name": 403 } ], "sidebar": true } [/block] Create a new chirp by passing an arbitrary JSON object, which is assigned a unique 10-character code that is ready to chirp. [block:code] { "codes": [ { "code": "{\n \"data\": {\n \"name\": \"kingfisher\",\n \"species\" : \"Alcedo atthis\",\n \"habitat\" : \"fresh-water\"\n }\n}", "language": "json", "name": "Body" } ] } [/block] The return value assigns the data a unique `shortcode`, plus a `longcode` which includes error-correction characters that are needed for reliable audio transmission. [block:code] { "codes": [ { "code": "{\n \"longcode\": \"dcr4j9a2tm2q78em2t\",\n \"created_at\": \"2016-02-11T16:27:36.179000\",\n \"shortcode\": \"dcr4j9a2tm\",\n \"public\": true,\n \"data\": {\n \"name\": \"kingfisher\",\n \"species\" : \"Alcedo atthis\",\n \"habitat\" : \"fresh-water\"\n }\n}", "language": "json", "name": "Return Value" } ] } [/block] This shortcode can then be passed directly to your platform-specific SDK to chirp the data. A receiving device can then query the API server for the matching shortcode, thus receiving the original payload. [block:code] { "codes": [ { "code": "[chirpShortcode:@\"dcr4j9a2tm\" withCompletion:^(Chirp *chirp, NSError *error)\n{\n if (!error)\n NSLog(@\"Chirped OK.\");\n}]", "language": "objectivec" } ] } [/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 }}