{"_id":"563a2dbc1846790d00895310","category":{"_id":"563a2dbb1846790d0089530a","__v":3,"pages":["563a2dbc1846790d0089530f","563a2dbc1846790d00895310","563a2dbc1846790d00895311","563a2dbc1846790d00895312","563a2dbc1846790d00895313","563a2dbc1846790d00895314","563a2dbc1846790d00895315","563a2dbc1846790d00895316","563a2dbc1846790d00895317","566232310299ea0d008f2cf2","56623a2d0299ea0d008f2cf6"],"project":"54d4ecb5f6c48a0d00f0f041","version":"563a2dba1846790d00895309","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-06T16:32:54.503Z","from_sync":false,"order":2,"slug":"documentation","title":"Documentation"},"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"},"user":"54d4ec36f6c48a0d00f0f040","__v":0,"project":"54d4ecb5f6c48a0d00f0f041","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-02T14:58:34.396Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Instacount uses custom media types to let consumers choose the format of the data they wish to receive, as well as to specify the version of a particular API to utilize.  This is done by adding one or more Instacount media types to the ***Accept*** header when making a request.  \n\nAll Instacount media types look like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"application/vnd.instacount[.version][+json]\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\nThe most basic media types the API supports are:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"application/json\\napplication/vnd.instacount+json\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\nNeither of these specify a version, so by using them you will always retrieve the current default JSON representation of resources.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"The default version of the API may change in the future. If you're building an application and care about the stability of the API, be sure to request a specific version in the Accept header as shown in the examples below.\",\n  \"title\": \"Best Practice: Always Specify an API Version\"\n}\n[/block]\nYou can check the current version of the API by inspecting the ***Content-Type*** header of every response:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl https://api.instacount.io/sharded_counters/bean-counter -I\\nHTTP/1.1 200 OK\\nContent-Type: application/vnd.instacount.v1+json\\n\\n$ curl https://api.instacount.io/sharded_counters/bean-counter -I \\\\\\n  -H \\\"Accept: application/json\\\"\\nHTTP/1.1 200 OK\\nContent-Type: application/vnd.instacount.v1+json\\n\\n$ curl https://api.instacount.io/sharded_counters/bean-counter -I \\\\\\n  -H \\\"Accept: application/vnd.instacount+json\\\"\\nHTTP/1.1 200 OK\\nContent-Type: application/vnd.instacount.v1+json\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]","excerpt":"Use media types to ensure proper content types and API versions.","slug":"media-types","type":"basic","title":"Media Types"}

Media Types

Use media types to ensure proper content types and API versions.

Instacount uses custom media types to let consumers choose the format of the data they wish to receive, as well as to specify the version of a particular API to utilize. This is done by adding one or more Instacount media types to the ***Accept*** header when making a request. All Instacount media types look like this: [block:code] { "codes": [ { "code": "application/vnd.instacount[.version][+json]", "language": "http" } ] } [/block] The most basic media types the API supports are: [block:code] { "codes": [ { "code": "application/json\napplication/vnd.instacount+json", "language": "http" } ] } [/block] Neither of these specify a version, so by using them you will always retrieve the current default JSON representation of resources. [block:callout] { "type": "info", "body": "The default version of the API may change in the future. If you're building an application and care about the stability of the API, be sure to request a specific version in the Accept header as shown in the examples below.", "title": "Best Practice: Always Specify an API Version" } [/block] You can check the current version of the API by inspecting the ***Content-Type*** header of every response: [block:code] { "codes": [ { "code": "$ curl https://api.instacount.io/sharded_counters/bean-counter -I\nHTTP/1.1 200 OK\nContent-Type: application/vnd.instacount.v1+json\n\n$ curl https://api.instacount.io/sharded_counters/bean-counter -I \\\n -H \"Accept: application/json\"\nHTTP/1.1 200 OK\nContent-Type: application/vnd.instacount.v1+json\n\n$ curl https://api.instacount.io/sharded_counters/bean-counter -I \\\n -H \"Accept: application/vnd.instacount+json\"\nHTTP/1.1 200 OK\nContent-Type: application/vnd.instacount.v1+json", "language": "curl" } ] } [/block]