{"_id":"542ac32254d88d140075fc3c","version":{"_id":"542ac32254d88d140075fc39","__v":4,"project":"542ac32254d88d140075fc36","createdAt":"2014-09-30T14:50:10.500Z","releaseDate":"2014-09-30T14:50:10.500Z","categories":["542ac32254d88d140075fc3a","542af0fd54d88d140075ff1b","542af128cedcfc140004b8d0","5537e2870899730d0081368d"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"project":"542ac32254d88d140075fc36","is_link":false,"user":"542ac2d054d88d140075fc29","__v":9,"category":{"_id":"542ac32254d88d140075fc3a","__v":7,"pages":["542ac32254d88d140075fc3c","55369f1f6fd3c40d00334978","5537e1563faac70d00ff6da6","5537e1f63e785d0d00be3feb","5537e22249a5800d00a28e54","5537e24b3faac70d00ff6da8","5537e26349a5800d00a28e56"],"project":"542ac32254d88d140075fc36","version":"542ac32254d88d140075fc39","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-09-30T14:50:10.530Z","from_sync":false,"order":0,"slug":"documentation","title":"Documentation"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-09-30T14:50:10.566Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"basic_auth":false,"results":{"codes":[]},"settings":"","try":true,"auth":"never","params":[],"url":""},"isReference":false,"order":1,"body":"There are two ways of creating a dataset through Exversion's API. The first is to create a brand new empty dataset. The second is to fork an existing dataset, creating a new version of data that already exists on Exversion's servers.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"POST /dataset/create\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"parameter\",\n    \"h-1\": \"value\",\n    \"0-0\": \"access_token\",\n    \"0-1\": \"The access token provided by OAuth authentication. Can also be generated directly on Exversion's web platform if you only want to access your own account.\",\n    \"1-0\": \"name\",\n    \"2-0\": \"description\",\n    \"3-0\": \"source_url\",\n    \"4-0\": \"source_author\",\n    \"5-0\": \"source_date\",\n    \"6-0\": \"source_contact\",\n    \"7-0\": \"private\",\n    \"1-1\": \"The name of your dataset\",\n    \"2-1\": \"A description of the data in your dataset\",\n    \"3-1\": \"A link to the organization that collected the data\",\n    \"4-1\": \"The name of the organization or individual who collected the data\",\n    \"5-1\": \"When the data was collected\",\n    \"6-1\": \"Contact information for more information about the data\",\n    \"7-1\": \"Is the data private or public. Value either 0 (public) or 1 (private)\"\n  },\n  \"cols\": 2,\n  \"rows\": 8\n}\n[/block]\n**Example Requests:**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import requests\\nimport json\\n\\nurl = 'https://www.exversion.com/api/v1/dataset/create/'\\npayload = {'access_token':[YOUR ACCESS TOKEN], 'name':'My First Dataset', 'description':'this was created with the api', 'source_url':'http://www.exversion.com','source_author':'Me','source_date':'August 7, 2013', 'source_contact':'info:::at:::exversion.com', 'private':0}\\n\\nr = requests.post(url, data=json.dumps(payload))\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"<?php\\n\\t$post = json_encode(\\n    array('access_token'=>[YOUR ACCESS TOKEN],\\n          'name'=>'My First Dataset',\\n          'description'=>'this was created with the api',\\n          'source_url'=>'http://www.exversion.com',\\n          'source_author'=>'Me',\\n          'source_date'=>'August 7, 2013',\\n          'source_contact'=>'info@exversion.com',\\n          'private'=>0)\\n  );\\n\\t\\t\\n\\t$ch = curl_init('https://www.exversion.com/api/v1/dataset/create/');       curl_setopt($ch, CURLOPT_CUSTOMREQUEST, \\\"POST\\\");                           curl_setopt($ch, CURLOPT_POSTFIELDS, $post);                               curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                           curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                 \\t\\t'Content-Type: application/json',                                       \\t\\t'Content-Length: ' . strlen($post))                                \\t );                                                                         $result = json_decode(curl_exec($ch));\\n?>\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"require 'unirest'\\nresponse = Unirest.post \\\"https://www.exversion.com/api/v1/dataset/create/\\\", \\n\\t\\theaders:{ \\\"Accept\\\" => \\\"application/json\\\" }, \\n    parameters:{'access_token'=>[YOUR ACCESS TOKEN],\\n                'name'=>'My First Dataset',\\n                'description'=>'this was created with the api',\\n                'source_url'=>'http://www.exversion.com',\\n                'source_author'=>'Me',\\n                'source_date'=>'August 7, 2013',\\n                'source_contact'=>'info@exversion.com',\\n                'private'=>0}\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\n**Example Response:** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\\"status\\\":200,\\n \\\"message\\\":\\\"Success\\\",\\n \\\"body\\\":[\\n   {\\n     \\\"dataset\\\":\\\"EV5XF25RH3MIMPP\\\",\\n     \\\"sourceURL\\\":\\\"http:\\\\/\\\\/www.exversion.com\\\",\\n     \\\"sourceAuthor\\\":\\\"Me\\\",\\n     \\\"sourceDate\\\":\\\"August 7, 2013\\\",\\n     \\\"sourceContact\\\":\\\"info@exversion.com\\\",\\n     \\\"uploadedBy\\\":{\\\"id\\\":\\\"1\\\",\\\"name\\\":\\\"bellmar\\\"},\\n     \\\"name\\\":\\\"My First Dataset\\\",\\n     \\\"description\\\":\\\"this was created with the api\\\",\\n     \\\"heritage\\\":[],\\n     \\\"size\\\":0,\\n     \\\"forkchanges\\\":null,\\n     \\\"columns\\\":[\\\"\\\"]\\n   }\\n ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"POST /dataset/fork\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"parameter\",\n    \"h-1\": \"value\",\n    \"0-0\": \"access_token\",\n    \"0-1\": \"The access token provided by OAuth authentication. Can also be generated directly on Exversion's web platform if you only want to access your own account.\",\n    \"1-0\": \"name\",\n    \"1-1\": \"The name of dataset to be created\",\n    \"2-0\": \"parent\",\n    \"2-1\": \"ID of the dataset to make a fork of\",\n    \"3-0\": \"forkchanges\",\n    \"3-1\": \"A description of how this dataset differs from its parent (changed schema, cleaned missing values, etc)\",\n    \"4-0\": \"track\",\n    \"4-1\": \"Should this dataset update automatically when its parent updates?\",\n    \"5-0\": \"private\",\n    \"5-1\": \"Is the data private or public. Value either 0 (public) or 1 (private)\",\n    \"6-0\": \"clear\",\n    \"6-1\": \"Should we clear the fork of all data? This is useful if you plan on remapping or otherwise making significant changes to the dataset schema\"\n  },\n  \"cols\": 2,\n  \"rows\": 7\n}\n[/block]\n**Example Requests**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import requests\\nimport json\\n\\nurl = 'https://www.exversion.com/api/v1/dataset/fork/'\\npayload = {'access_token':[YOUR ACCESS TOKEN],'parent':[DATASET ID OF PARENT],'name':\\\"A Better Version of My First Dataset\\\",'forkchanges':\\\"Adding missing values\\\",'track':0,'private':0, 'clear':0}\\nr = requests.post(url, data=json.dumps(payload))\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"<?php\\n\\t$post = json_encode(\\n    array('access_token'=>[YOUR ACCESS TOKEN],\\n          'parent'=>[DATASET ID OF PARENT],\\n          'name'=>\\\"A Better Version of My First Dataset\\\",\\n          'forkchanges'=>\\\"Adding missing values\\\",\\n          'track'=>0,\\n          'private'=>0,\\n          'clear'=>0)\\n  );\\n\\t\\t\\n$ch = curl_init('https://www.exversion.com/api/v1/dataset/fork/');       curl_setopt($ch, CURLOPT_CUSTOMREQUEST, \\\"POST\\\");                           curl_setopt($ch, CURLOPT_POSTFIELDS, $post);                               curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                           curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                 \\t\\t'Content-Type: application/json',                                       \\t\\t'Content-Length: ' . strlen($post))                                \\t );                                                                         $result = json_decode(curl_exec($ch));\\n?>\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"require 'unirest'\\nresponse = Unirest.post \\\"https://www.exversion.com/api/v1/dataset/fork/\\\", \\n\\t\\theaders:{ \\\"Accept\\\" => \\\"application/json\\\" }, \\n    parameters:{'access_token'=>[YOUR ACCESS TOKEN],\\n          'parent'=>[DATASET ID OF PARENT],\\n          'name'=>\\\"A Better Version of My First Dataset\\\",\\n          'forkchanges'=>\\\"Adding missing values\\\",\\n          'track'=>0,\\n          'private'=>0,\\n          'clear'=>0}\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\n**Example Response**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\\"status\\\":200,\\n \\\"message\\\":\\\"Success\\\",\\n \\\"body\\\":[\\n   {\\n     \\\"dataset\\\":\\\"EV5XF25RH3MIMPZ\\\",\\n     \\\"sourceURL\\\":\\\"http:\\\\/\\\\/www.exversion.com\\\",\\n     \\\"sourceAuthor\\\":\\\"Me\\\",\\n     \\\"sourceDate\\\":\\\"August 7, 2013\\\",\\n     \\\"sourceContact\\\":\\\"info@exversion.com\\\",\\n     \\\"uploadedBy\\\":{\\\"id\\\":\\\"1\\\",\\\"name\\\":\\\"bellmar\\\"},\\n     \\\"name\\\":\\\"A Better Version of My First Dataset\\\",\\n     \\\"description\\\":\\\"this was created with the api\\\",\\n     \\\"heritage\\\":[\\\"EV5XF25RH3MIMPP\\\"],\\n     \\\"size\\\":100,\\n     \\\"forkchanges\\\":\\\"Adding missing values\\\",\\n     \\\"columns\\\":[\\\"cola, colb, colc\\\"],\\n     \\\"private\\\":0\\n   }\\n ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"getting-started","type":"basic","title":"Creating a Dataset"}

Creating a Dataset


There are two ways of creating a dataset through Exversion's API. The first is to create a brand new empty dataset. The second is to fork an existing dataset, creating a new version of data that already exists on Exversion's servers. [block:api-header] { "type": "basic", "title": "POST /dataset/create" } [/block] [block:parameters] { "data": { "h-0": "parameter", "h-1": "value", "0-0": "access_token", "0-1": "The access token provided by OAuth authentication. Can also be generated directly on Exversion's web platform if you only want to access your own account.", "1-0": "name", "2-0": "description", "3-0": "source_url", "4-0": "source_author", "5-0": "source_date", "6-0": "source_contact", "7-0": "private", "1-1": "The name of your dataset", "2-1": "A description of the data in your dataset", "3-1": "A link to the organization that collected the data", "4-1": "The name of the organization or individual who collected the data", "5-1": "When the data was collected", "6-1": "Contact information for more information about the data", "7-1": "Is the data private or public. Value either 0 (public) or 1 (private)" }, "cols": 2, "rows": 8 } [/block] **Example Requests:** [block:code] { "codes": [ { "code": "import requests\nimport json\n\nurl = 'https://www.exversion.com/api/v1/dataset/create/'\npayload = {'access_token':[YOUR ACCESS TOKEN], 'name':'My First Dataset', 'description':'this was created with the api', 'source_url':'http://www.exversion.com','source_author':'Me','source_date':'August 7, 2013', 'source_contact':'info@exversion.com', 'private':0}\n\nr = requests.post(url, data=json.dumps(payload))", "language": "python" }, { "code": "<?php\n\t$post = json_encode(\n array('access_token'=>[YOUR ACCESS TOKEN],\n 'name'=>'My First Dataset',\n 'description'=>'this was created with the api',\n 'source_url'=>'http://www.exversion.com',\n 'source_author'=>'Me',\n 'source_date'=>'August 7, 2013',\n 'source_contact'=>'info@exversion.com',\n 'private'=>0)\n );\n\t\t\n\t$ch = curl_init('https://www.exversion.com/api/v1/dataset/create/'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\"); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( \t\t'Content-Type: application/json', \t\t'Content-Length: ' . strlen($post)) \t ); $result = json_decode(curl_exec($ch));\n?>", "language": "php" }, { "code": "require 'unirest'\nresponse = Unirest.post \"https://www.exversion.com/api/v1/dataset/create/\", \n\t\theaders:{ \"Accept\" => \"application/json\" }, \n parameters:{'access_token'=>[YOUR ACCESS TOKEN],\n 'name'=>'My First Dataset',\n 'description'=>'this was created with the api',\n 'source_url'=>'http://www.exversion.com',\n 'source_author'=>'Me',\n 'source_date'=>'August 7, 2013',\n 'source_contact'=>'info@exversion.com',\n 'private'=>0}", "language": "ruby" } ] } [/block] **Example Response:** [block:code] { "codes": [ { "code": "{\"status\":200,\n \"message\":\"Success\",\n \"body\":[\n {\n \"dataset\":\"EV5XF25RH3MIMPP\",\n \"sourceURL\":\"http:\\/\\/www.exversion.com\",\n \"sourceAuthor\":\"Me\",\n \"sourceDate\":\"August 7, 2013\",\n \"sourceContact\":\"info@exversion.com\",\n \"uploadedBy\":{\"id\":\"1\",\"name\":\"bellmar\"},\n \"name\":\"My First Dataset\",\n \"description\":\"this was created with the api\",\n \"heritage\":[],\n \"size\":0,\n \"forkchanges\":null,\n \"columns\":[\"\"]\n }\n ]\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "POST /dataset/fork" } [/block] [block:parameters] { "data": { "h-0": "parameter", "h-1": "value", "0-0": "access_token", "0-1": "The access token provided by OAuth authentication. Can also be generated directly on Exversion's web platform if you only want to access your own account.", "1-0": "name", "1-1": "The name of dataset to be created", "2-0": "parent", "2-1": "ID of the dataset to make a fork of", "3-0": "forkchanges", "3-1": "A description of how this dataset differs from its parent (changed schema, cleaned missing values, etc)", "4-0": "track", "4-1": "Should this dataset update automatically when its parent updates?", "5-0": "private", "5-1": "Is the data private or public. Value either 0 (public) or 1 (private)", "6-0": "clear", "6-1": "Should we clear the fork of all data? This is useful if you plan on remapping or otherwise making significant changes to the dataset schema" }, "cols": 2, "rows": 7 } [/block] **Example Requests** [block:code] { "codes": [ { "code": "import requests\nimport json\n\nurl = 'https://www.exversion.com/api/v1/dataset/fork/'\npayload = {'access_token':[YOUR ACCESS TOKEN],'parent':[DATASET ID OF PARENT],'name':\"A Better Version of My First Dataset\",'forkchanges':\"Adding missing values\",'track':0,'private':0, 'clear':0}\nr = requests.post(url, data=json.dumps(payload))", "language": "python" }, { "code": "<?php\n\t$post = json_encode(\n array('access_token'=>[YOUR ACCESS TOKEN],\n 'parent'=>[DATASET ID OF PARENT],\n 'name'=>\"A Better Version of My First Dataset\",\n 'forkchanges'=>\"Adding missing values\",\n 'track'=>0,\n 'private'=>0,\n 'clear'=>0)\n );\n\t\t\n$ch = curl_init('https://www.exversion.com/api/v1/dataset/fork/'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\"); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( \t\t'Content-Type: application/json', \t\t'Content-Length: ' . strlen($post)) \t ); $result = json_decode(curl_exec($ch));\n?>", "language": "php" }, { "code": "require 'unirest'\nresponse = Unirest.post \"https://www.exversion.com/api/v1/dataset/fork/\", \n\t\theaders:{ \"Accept\" => \"application/json\" }, \n parameters:{'access_token'=>[YOUR ACCESS TOKEN],\n 'parent'=>[DATASET ID OF PARENT],\n 'name'=>\"A Better Version of My First Dataset\",\n 'forkchanges'=>\"Adding missing values\",\n 'track'=>0,\n 'private'=>0,\n 'clear'=>0}", "language": "ruby" } ] } [/block] **Example Response** [block:code] { "codes": [ { "code": "{\"status\":200,\n \"message\":\"Success\",\n \"body\":[\n {\n \"dataset\":\"EV5XF25RH3MIMPZ\",\n \"sourceURL\":\"http:\\/\\/www.exversion.com\",\n \"sourceAuthor\":\"Me\",\n \"sourceDate\":\"August 7, 2013\",\n \"sourceContact\":\"info@exversion.com\",\n \"uploadedBy\":{\"id\":\"1\",\"name\":\"bellmar\"},\n \"name\":\"A Better Version of My First Dataset\",\n \"description\":\"this was created with the api\",\n \"heritage\":[\"EV5XF25RH3MIMPP\"],\n \"size\":100,\n \"forkchanges\":\"Adding missing values\",\n \"columns\":[\"cola, colb, colc\"],\n \"private\":0\n }\n ]\n}", "language": "json" } ] } [/block]