{"_id":"563a2dbd1846790d00895318","user":"54d4ec36f6c48a0d00f0f040","editedParams2":true,"version":{"_id":"563a2dba1846790d00895309","__v":3,"project":"54d4ecb5f6c48a0d00f0f041","createdAt":"2015-11-04T16:09:30.844Z","releaseDate":"2015-11-04T16:09:30.844Z","categories":["563a2dbb1846790d0089530a","563a2dbb1846790d0089530b","563a2dbb1846790d0089530c","56620e60f183880d004d3217","5702e5b8f2d6f336005e9025"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"No Mashape","version_clean":"1.1.0","version":"1.1"},"category":{"_id":"563a2dbb1846790d0089530b","project":"54d4ecb5f6c48a0d00f0f041","pages":["563a2dbd1846790d00895318","563a2dbd1846790d00895319","563a2dbd1846790d0089531a","563a2dbd1846790d0089531b","563a2dbd1846790d0089531c","563a2dbd1846790d0089531d","563a2dbd1846790d0089531e"],"version":"563a2dba1846790d00895309","__v":1,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-06T16:37:55.318Z","from_sync":false,"order":3,"slug":"endpoints","title":"API Endpoints"},"project":"54d4ecb5f6c48a0d00f0f041","__v":3,"editedParams":true,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-04-06T22:58:36.699Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":201,"language":"http","code":"*No Content*","name":null},{"status":400,"language":"json","code":"{\n  \"errors\": [\n    {\n      \"message\": \"Counter names may not exceed 500 characters!\",\n      \"developerMessage\": \"Counter names may not exceed 500 characters!\",\n      \"moreInfo\": \"https://instacount.readme.io/docs/errors\"\n    }\n  ]\n}"},{"status":401,"language":"json","code":"{\n  \"errors\": [\n    {\n      \"message\": \"You must be signed-in to access the information you requested.\",\n      \"developerMessage\": \"You must enable proper Instacount Authentication!  Invalid X-Instacount-API-Key Header!\",\n      \"moreInfo\": \"https://instacount.readme.io\"\n    }\n  ]\n}"}]},"settings":"","examples":{"codes":[{"name":"Example Creation Payload","code":"{     \n\t\"name\": \"num-followers-abc\",\n  \"description\" : \"The number of followers for user 'abc'\",\n  \"status\": \"AVAILABLE\"\n}","language":"json"}]},"method":"post","auth":"required","params":[{"_id":"564fba6d66438d0d0026ee17","ref":"","in":"body","required":false,"desc":"An optionally supplied unique name for the counter to be created.  This value is limited to 500 UTF-16 Unicode characters.  If not specified, a counter name will be auto-generated.  When used in a URL, the counter name must be URL-encoded.","default":"number-of-beans","type":"string","name":"name"},{"_id":"564fba6d66438d0d0026ee16","ref":"","in":"body","required":false,"desc":"An optionally supplied description of the counter to be created. This value is limited to 500 characters, and may contain any UTF-16 Unicode characters.","default":"The number of beans I have","type":"string","name":"description"},{"_id":"564fbaf3c97d4f2100fd5f67","ref":"","in":"body","required":false,"desc":"An optionally supplied counter status.  Can be either 'AVAILABLE' or 'READ_ONLY_COUNT'.","default":"AVAILABLE","type":"string","name":"status"}],"url":"/sharded_counters"},"isReference":false,"order":0,"body":"To create a sharded counter, make a POST request to this endpoint with no parameters nor payload.  Upon successful creation, the following headers will be returned in the response: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Location: https://api.instacount.io/sharded_counters/ef5fda8e-a5a5-4fbd-bbdd-b36e9e2e57f1\",\n      \"language\": \"http\",\n      \"name\": \"HTTP Response Headers\"\n    }\n  ]\n}\n[/block]\nCounters created in this manner will have an Instacount-assigned counter name.  If you wish to specify the counter name or description at creation time, you may do so by including a JSON payload with your request.  For example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{     \\n\\t\\\"name\\\": \\\"num-followers-abc\\\",\\n  \\\"description\\\" : \\\"The number of followers for user 'abc'\\\",\\n  \\\"status\\\": \\\"AVAILABLE\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Create Counter Payload\"\n    }\n  ]\n}\n[/block]\nIf the request succeeds, you will receive a response with headers similar to the sample response above:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Location: https://api.instacount.io/sharded_counters/num-followers-abc\",\n      \"language\": \"http\",\n      \"name\": \"HTTP Response Headers\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"In the Instacount dashboard, you can define multiple **applications** to store counters in.  Each application is logically separated from the others, which allows counters with the same name to co-exist across differing applications without affecting identically named counters in other applications.\",\n  \"title\": \"Applications and Counter Names\"\n}\n[/block]","excerpt":"Create a new counter","slug":"shardedcounters-1","type":"endpoint","title":"Create a Counter"}

postCreate a Counter

Create a new counter

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

name:
stringnumber-of-beans
An optionally supplied unique name for the counter to be created. This value is limited to 500 UTF-16 Unicode characters. If not specified, a counter name will be auto-generated. When used in a URL, the counter name must be URL-encoded.
description:
stringThe number of beans I have
An optionally supplied description of the counter to be created. This value is limited to 500 characters, and may contain any UTF-16 Unicode characters.
status:
stringAVAILABLE
An optionally supplied counter status. Can be either 'AVAILABLE' or 'READ_ONLY_COUNT'.

Examples


Result Format


Documentation

To create a sharded counter, make a POST request to this endpoint with no parameters nor payload. Upon successful creation, the following headers will be returned in the response: [block:code] { "codes": [ { "code": "Location: https://api.instacount.io/sharded_counters/ef5fda8e-a5a5-4fbd-bbdd-b36e9e2e57f1", "language": "http", "name": "HTTP Response Headers" } ] } [/block] Counters created in this manner will have an Instacount-assigned counter name. If you wish to specify the counter name or description at creation time, you may do so by including a JSON payload with your request. For example: [block:code] { "codes": [ { "code": "{ \n\t\"name\": \"num-followers-abc\",\n \"description\" : \"The number of followers for user 'abc'\",\n \"status\": \"AVAILABLE\"\n}", "language": "json", "name": "Create Counter Payload" } ] } [/block] If the request succeeds, you will receive a response with headers similar to the sample response above: [block:code] { "codes": [ { "code": "Location: https://api.instacount.io/sharded_counters/num-followers-abc", "language": "http", "name": "HTTP Response Headers" } ] } [/block] [block:callout] { "type": "info", "body": "In the Instacount dashboard, you can define multiple **applications** to store counters in. Each application is logically separated from the others, which allows counters with the same name to co-exist across differing applications without affecting identically named counters in other applications.", "title": "Applications and Counter Names" } [/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 }}