{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"2b269b1d-ffae-4124-aa8f-0fac70b04620","name":"Comcar RESTful API v1","description":"This documentation lists all the endpoints in the API and provides example snippets of how to call the API in popular languages.\n\nThe data returned will be limited by your account to certain vehicle makes (manufacturers) and types.\n\n\n# API navigation\n\nThe API is broken up into two key sections; `api.comcar.co.uk/vehicles/` and `api.comcar.co.uk/prices/`\n\n## Vehicles\n\nVehicle API results will provide an array of endpoints that can be visited with returned data.\n\nFor example, getting a list of makes will provide endpoints to get models for those makes. \nA list of models will return endpoints to get vehicles, grades or engines for those models.\n\nYou can step down through the API using the endpoints array. If no array is provided then there's no deeper route into that part of the api.\n\n## Prices\n\nPrice API results will provide a list of prices and vehicle information. These can be filtered by several fields, please see the prices documentation for further information.\n\n\n# Pagination\nWhen requesting data from the API the results will be paginated.\n\nThe query string parameters are used to paginate through the results:\n\n`page_size` The default page size is 100. The maximum page size is 500.\n\n`page` The page number you are requesting.\n\nA JSON request will include the following in the response: \n\n`page` The current page \n\n`page_count` The total number of pages \n\n`total_count` The total number of results\n\nNote: The `page_count` and `total_count` fields are only returned with on the first page. You can then use these values to paginate through hte remainder of te results.\n\n# Authentication\n\nWith each request you'll need to pass the following:\n\n- a message hash (HMAC hashed, explained below)\n- your api key\n- a random cryptographic nonce\n- the current unix timestamp (seconds since 1st Jan 1970)\n\n## Building the hash\n\nThe hash is made up of the message, body, your api secret, the nonce and the timestamp concatenated and then encrypted with SHA256\n\nThe message body is made up of key/value pairs of any GET parameters sent in the request, put into alphabetical order.\n\nCurrently, there is no filtering/pagination/limiting so this can just be left blank.\n\n## Example HMAC in Postman\n\nYou can add this to a Postman pre-request script, in order to create a hash with each request and update environment variables.\n\nSimilarly in any programmign language you use to call the API, you'll need to run a function to build your hash and attach it as a header to the API call.\n\n```\n// build the hash\nvar current_timestamp = ((new Date()).getTime() / 1000).toFixed();\npostman.setEnvironmentVariable('this_timestamp', current_timestamp );\n\npostman.setEnvironmentVariable('this_nonce', Math.floor( Math.random() * 10000 ));\n\n// the message is made up of the order/filter etc params\n// params need to be put into alphabetical order\nvar current_message = '';\nvar query_params = postman.__execution.request.url.query;\nvar struct_params = {};\n\n// make a simple struct of key/value pairs\nquery_params.each(function(param){\n    // check if the key is not disabled\n    if( !param.disabled ) {\n        struct_params[ param.key ] = param.value;\n    }\n});\n\n// make an ordered array of key names\nvar arr_param_names = Object.keys( struct_params ).sort();\n\n// add the params in order to the message\narr_param_names.each(function(param){\n    // get the value, blank if it's null\n    var val = struct_params[ param ]||'';\n    // if the value is not blank, add it to the message\n    if( val !== '' ) {\n        current_message+=param+'='+val;\n    }\n});\n\nvar combined_data = environment.api_key\n\t\t\t\t+ current_message\n\t\t\t\t+ environment.api_secret\n\t\t\t\t+ environment.this_nonce\n\t\t\t\t+ environment.this_timestamp\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n// make lower case\ncombined_data = combined_data.toLowerCase();\n\ngenerated_hash = CryptoJS.SHA256( combined_data );\n\npostman.setEnvironmentVariable('generated_hash', generated_hash);\n```","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":true,"owner":"3327718","team":310780,"collectionId":"2b269b1d-ffae-4124-aa8f-0fac70b04620","publishedId":"SzS4SSvu","public":true,"publicUrl":"https://documenter-api.postman.tech/view/3327718/SzS4SSvu","privateUrl":"https://go.postman.co/documentation/3327718-2b269b1d-ffae-4124-aa8f-0fac70b04620","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"documentationLayout":"classic-double-column","version":"8.11.6","publishDate":"2020-03-17T09:57:45.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[{"name":"Comcar API Example (fake keys etc) v1","id":"3dcdc821-3152-4bb8-b837-1463fd748ae5","owner":"3327718","values":[{"key":"api_key","value":"API_KEY","enabled":true},{"key":"api_secret","value":"API_KEY","enabled":true},{"key":"generated_hash","value":"22a97e2ad521e1255395f8d8ba4aa62f00469e71dd1b08454907a22dd7a6a8cd","enabled":true},{"key":"this_nonce","value":"9965","enabled":true},{"key":"this_timestamp","value":"1598522316","enabled":true},{"key":"vehicle_id","value":"0000175405","enabled":true},{"key":"make","value":"audi","enabled":true},{"key":"model","value":"a4 saloon","enabled":true},{"key":"grade","value":"se","enabled":true},{"key":"engine","value":"1.4 T-Jet 180hp","enabled":true},{"key":"api_url","value":"api.comcar.co.uk","enabled":true},{"key":"dev_server","value":"","enabled":true},{"key":"version_number","value":"v1","enabled":true}],"published":true}],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/044c1aae73bb5ef732c06fecae3f70dd764fe043934ac583402e874335467b16","favicon":""},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"},{"label":"Comcar API Example (fake keys etc) v1","value":"3327718-3dcdc821-3152-4bb8-b837-1463fd748ae5"}],"canonicalUrl":"https://documenter.gw.postman.com/view/metadata/SzS4SSvu"}