{"__v":1,"_id":"54db8912c6a4d40d0034b941","category":{"__v":7,"_id":"54fdad6e660db63700c23b82","pages":["55fbef82af72eb0d0007df93","55fbf623e013770d008fcba8","5617bd3a26e3db230054fba4","5617c4a6f8c9632100ac74f5","561ed6fd0a04340d00d8a0b0","562156adf4e0352100cbf268","562a5c846049f20d0032520b"],"project":"54d0fd1d095c470d00d1646d","version":"54d0fd1e095c470d00d16470","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-03-09T14:25:50.133Z","from_sync":false,"order":2,"slug":"api-reference","title":"API Reference"},"editedParams":true,"editedParams2":true,"project":"54d0fd1d095c470d00d1646d","user":"54db525474dfff3700f161e9","version":{"__v":20,"_id":"54d0fd1e095c470d00d16470","project":"54d0fd1d095c470d00d1646d","createdAt":"2015-02-03T16:53:50.090Z","releaseDate":"2015-02-03T16:53:50.090Z","categories":["54d0fd1e095c470d00d16471","54d8b5e68934140d00496544","54db6361c6a4d40d0034b8f7","54db638208ea010d00ab1fdd","54db639008ea010d00ab1fde","54db6547c6a4d40d0034b8fd","54db83482092743700ea6ee1","54db84afc6a4d40d0034b93c","54db8805c6a4d40d0034b93f","54db8de9c6a4d40d0034b961","54db931ac6a4d40d0034b96d","54e49219e4365521006fd9ee","54e74fcc652d7c1900cbe737","54e74ffd3c1e111700d05762","54e77e0a523b1b2f00e6f313","54e784affdabe62500fcddcf","54e784fa523b1b2f00e6f319","54e785de8ae8911900cd42c5","54fdad6e660db63700c23b82","54fdff31f7b1202100a25e06"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-02-11T16:53:38.788Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"import a CSV file","code":"curl -k --user \"MY_API_KEY:\" -XPOST -H \"Content-Type: application/json\" \\\nhttp://api.gogeo.io/1.0/imports -d '\n{\n\t\"database\": \"guides\",\n  \"collection_name\": \"my_collection\",\n  \"url\": \"https://www.dropbox.com/s/rw0q82cu8ll2qcu/basic.csv?dl=1\",\n  \"elasticsearch_index\": [ \"name\", \"city\" ],\n  \"metadata\": {    \n    \"header\": true,\n    \"field_delimiter\": \";\",\n    \"row_delimiter\": \"\\n\",\n    \"geom\": {\n      \"type\": \"wkt_point\",\n      \"fields\": [\n        \"the_geom\"\n      ]\n    },\n    \"mapping\": [\n      [ \"code\",       \"string\"    ],\n      [ \"name\",       \"string\"    ],\n      [ \"street\",     \"string\"    ],\n      [ \"city\",       \"string\"    ],\n      [ \"state\",      \"string\"    ],\n      [ \"employees\",  \"int\"       ],\n      [ \"revenue\",    \"long\"      ],\n      [ \"lat\",        \"float\"     ],\n      [ \"lon\",        \"float\"     ],\n      [ \"the_geom\",   \"wkt_point\" ]\n    ]\n  }\n}'","language":"shell"}]},"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"database_id\": \"52666b67a7f454e5b9000001\",\n  \"database_name\": \"guides\",\n  \"collection_name\": \"my_collection\",\n  \"url\": \"https://www.dropbox.com/s/rw0q82cu8ll2qcu/basic.csv?dl=1\",\n  \"elasticsearch_index\": [],\n  \"estimated_items\": 5, // Estimated quantity of items (wc -l)\n  \"items\": 5, // Number of inserted items\n  \"extension\": \"csv\", // Extension file\n  \"extract?\": false, // It is to decompress?\n  \"id\": \"53b3019d726f623dab000000\",\n  \"operation\": \"insert\", // Operation (download, extract or insert)\n  \"stage\": \"finished\", // Operation stage (waiting, done, error or finished)\n  \"progress\": 100.0,\n  \"size\": 648, // File size in bytes\n  \"created_at\": \"2014-07-01T15:44:45.933-03:00\",\n  \"updated_at\": \"2014-07-01T15:44:46.526-03:00\",\n  \"user_id\": \"52666b4ca7f454a06f000001\",\n  \"user_name\": \"robertogyn19\",\n  \"metadata\": {    \n    \"header\": true,\n    \"field_delimiter\": \";\",\n    \"row_delimiter\": \"\\n\",\n    \"geom\": {\n      \"type\": \"wkt_point\",\n      \"fields\": [\n        \"the_geom\"\n      ]\n    },\n    \"mapping\": [\n      [ \"code\",       \"string\"    ],\n      [ \"name\",       \"string\"    ],\n      [ \"street\",     \"string\"    ],\n      [ \"city\",       \"string\"    ],\n      [ \"state\",      \"string\"    ],\n      [ \"employees\",  \"int\"       ],\n      [ \"revenue\",    \"long\"      ],\n      [ \"lat\",        \"float\"     ],\n      [ \"lon\",        \"float\"     ],\n      [ \"the_geom\",   \"wkt_point\" ]\n    ]\n  }\n}","name":""}]},"auth":"required","params":[{"_id":"54db8912c6a4d40d0034b946","ref":"","in":"body","required":true,"desc":"Name or id of the database.","default":"","type":"string","name":"database"},{"_id":"54db8912c6a4d40d0034b945","ref":"","in":"body","required":true,"desc":"Name or id of the collection. If the collection does not exist, it will be created. Case the collection already exist, we have two scenarios: 1) the schema of collection is equal to the file imported and the data is inserted; 2) the schema of collection is not equal to the file imported (the ordering of columns is important) and an importing error is launched.","default":"","type":"string","name":"collection_name"},{"_id":"54db8912c6a4d40d0034b944","ref":"","in":"body","required":true,"desc":"URL of file.","default":"","type":"string","name":"url"},{"_id":"54db8912c6a4d40d0034b943","ref":"","in":"body","required":false,"desc":"Extension of file when it is compressed. Supported extensions: zip, rar, tar, tar.bz2.","default":"","type":"string","name":"extension"},{"_id":"54db8912c6a4d40d0034b942","ref":"","in":"body","required":false,"desc":"Indexes configured on Elasticsearch.","default":"","type":"array_string","name":"elasticsearch_index"},{"_id":"554bce5e3ca3e00d00536fc7","ref":"","in":"body","required":false,"desc":"Metadata if is a CSV file","default":"","type":"object","name":"metadata"}],"url":"/imports"},"isReference":false,"order":21,"body":"Import a file in the system. Returns a JSON object containing the status of the import. The result json contains the parameter **id** that will be used to look for import status.\n\n#### \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Sample Request\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --user <API-KEY>:\\\"\\\" -k -H \\\"Content-Type: application/json\\\" -XPOST \\\"http://api.gogeo.io/1.0/imports\\\" -d '\\n{\\n  \\\"database\\\": \\\"my_database\\\",\\n  \\\"collection_name\\\": \\\"my_collection\\\",\\n  \\\"url\\\": \\\"https://www.dropbox.com/s/rw0q82cu8ll2qcu/basic.csv?dl=1\\\",\\n  \\\"metadata\\\" : {\\n    \\\"field_delimiter\\\" : \\\";\\\",\\n    \\\"row_delimiter\\\" : \\\"\\\\n\\\",\\n    \\\"header\\\" : true,\\n    \\\"geom\\\" : {\\n      \\\"type\\\" : \\\"wkt_point\\\",\\n      \\\"fields\\\" : [\\\"my_point\\\"]\\n    },\\n    \\\"mapping\\\" : [\\n      [\\\"code\\\", \\\"string\\\"],\\n      [\\\"name\\\", \\\"string\\\"],\\n      [\\\"street\\\", \\\"string\\\"],\\n      [\\\"city\\\", \\\"string\\\"],\\n      [\\\"state\\\", \\\"string\\\"],\\n      [\\\"employees\\\", \\\"string\\\"],\\n      [\\\"revenue\\\", \\\"string\\\"],\\n      [\\\"latitude\\\", \\\"float\\\"],\\n      [\\\"longitude\\\", \\\"float\\\"],\\n      [\\\"my_point\\\", \\\"wkt_point\\\"]\\n    ]\\n  }\\n}'\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\n### Sample Response\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"database_id\\\": \\\"52666b67a7f454e5b9000001\\\",\\n  \\\"database_name\\\": \\\"guides\\\",\\n  \\\"collection_name\\\": \\\"my_collection\\\",\\n  \\\"url\\\": \\\"https://www.dropbox.com/s/rw0q82cu8ll2qcu/basic.csv?dl=1\\\",\\n  \\\"elasticsearch_index\\\": [],\\n  \\\"estimated_items\\\": 5, // Estimated quantity of items (wc -l)\\n  \\\"items\\\": 5, // Number of inserted items\\n  \\\"extension\\\": \\\"csv\\\", // Extension file\\n  \\\"extract?\\\": false, // It is to decompress?\\n  \\\"id\\\": \\\"53b3019d726f623dab000000\\\",\\n  \\\"operation\\\": \\\"insert\\\", // Operation (download, extract or insert)\\n  \\\"stage\\\": \\\"finished\\\", // Operation stage (waiting, done, error or finished)\\n  \\\"progress\\\": 100.0,\\n  \\\"size\\\": 648, // File size in bytes\\n  \\\"created_at\\\": \\\"2014-07-01T15:44:45.933-03:00\\\",\\n  \\\"updated_at\\\": \\\"2014-07-01T15:44:46.526-03:00\\\",\\n  \\\"user_id\\\": \\\"52666b4ca7f454a06f000001\\\",\\n  \\\"user_name\\\": \\\"robertogyn19\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<div class=\\\"panel panel-info teste\\\" >\\n  <div class=\\\"panel-body\\\">\\n    This endpoint requires an API key. See <a href=\\\"basic-auth\\\">Basic Authentication</a> for more information about the goGeo authentication system.\\n\\t\\t<br><br>\\n\\t  If you don't have an access key yet, <a href=\\\"https://console.gogeo.io/signup\\\">sign up</a> and take yours!\\n  </div>\\n</div>\\n\"\n}\n[/block]\n---\n[block:html]\n{\n  \"html\": \"<div class='div-middle'> \\n  <a href='#'>\\n    Top page &spades; </div>\\n  </a>\\n</div>\\n\\n<div class='div-back'> \\n  <a href='/v1.0/docs/data-import'>\\n    &laquo; Back \\n  </a>\\n</div>\\n\\n<div class='div-forward'> \\n  <a href='/v1.0/docs/list-all-imported-files'>\\n    Next &raquo; </div>\\n  </a>\\n</div>\\n\\n<style>\\n\\t.div-back {\\n  \\tpadding-left: 15px;\\n\\t\\tmargin-top: -20px;\\n  }\\n  \\n  .div-middle {\\n  \\ttext-align: center;\\n\\t\\tmargin-top: -15px;\\n  }\\n  \\n  .div-forward {\\n  \\tfloat: right;\\n    padding-right: 15px;\\n\\t\\tmargin-top: -20px;\\n  }\\n</style>\"\n}\n[/block]","excerpt":"Import a file in the system.","slug":"import-data","type":"post","title":"Import a file"}

postImport a file

Import a file in the system.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

database:
required
string
Name or id of the database.
collection_name:
required
string
Name or id of the collection. If the collection does not exist, it will be created. Case the collection already exist, we have two scenarios: 1) the schema of collection is equal to the file imported and the data is inserted; 2) the schema of collection is not equal to the file imported (the ordering of columns is important) and an importing error is launched.
url:
required
string
URL of file.
extension:
string
Extension of file when it is compressed. Supported extensions: zip, rar, tar, tar.bz2.
elasticsearch_index:
array of strings
Indexes configured on Elasticsearch.
metadata:
object
Metadata if is a CSV file

Examples


Result Format


Documentation

Import a file in the system. Returns a JSON object containing the status of the import. The result json contains the parameter **id** that will be used to look for import status. #### [block:api-header] { "type": "basic", "title": "Sample Request" } [/block] [block:code] { "codes": [ { "code": "curl --user <API-KEY>:\"\" -k -H \"Content-Type: application/json\" -XPOST \"http://api.gogeo.io/1.0/imports\" -d '\n{\n \"database\": \"my_database\",\n \"collection_name\": \"my_collection\",\n \"url\": \"https://www.dropbox.com/s/rw0q82cu8ll2qcu/basic.csv?dl=1\",\n \"metadata\" : {\n \"field_delimiter\" : \";\",\n \"row_delimiter\" : \"\\n\",\n \"header\" : true,\n \"geom\" : {\n \"type\" : \"wkt_point\",\n \"fields\" : [\"my_point\"]\n },\n \"mapping\" : [\n [\"code\", \"string\"],\n [\"name\", \"string\"],\n [\"street\", \"string\"],\n [\"city\", \"string\"],\n [\"state\", \"string\"],\n [\"employees\", \"string\"],\n [\"revenue\", \"string\"],\n [\"latitude\", \"float\"],\n [\"longitude\", \"float\"],\n [\"my_point\", \"wkt_point\"]\n ]\n }\n}'", "language": "curl" } ] } [/block] ### Sample Response [block:code] { "codes": [ { "code": "{\n \"database_id\": \"52666b67a7f454e5b9000001\",\n \"database_name\": \"guides\",\n \"collection_name\": \"my_collection\",\n \"url\": \"https://www.dropbox.com/s/rw0q82cu8ll2qcu/basic.csv?dl=1\",\n \"elasticsearch_index\": [],\n \"estimated_items\": 5, // Estimated quantity of items (wc -l)\n \"items\": 5, // Number of inserted items\n \"extension\": \"csv\", // Extension file\n \"extract?\": false, // It is to decompress?\n \"id\": \"53b3019d726f623dab000000\",\n \"operation\": \"insert\", // Operation (download, extract or insert)\n \"stage\": \"finished\", // Operation stage (waiting, done, error or finished)\n \"progress\": 100.0,\n \"size\": 648, // File size in bytes\n \"created_at\": \"2014-07-01T15:44:45.933-03:00\",\n \"updated_at\": \"2014-07-01T15:44:46.526-03:00\",\n \"user_id\": \"52666b4ca7f454a06f000001\",\n \"user_name\": \"robertogyn19\"\n}", "language": "json" } ] } [/block] [block:html] { "html": "<div class=\"panel panel-info teste\" >\n <div class=\"panel-body\">\n This endpoint requires an API key. See <a href=\"basic-auth\">Basic Authentication</a> for more information about the goGeo authentication system.\n\t\t<br><br>\n\t If you don't have an access key yet, <a href=\"https://console.gogeo.io/signup\">sign up</a> and take yours!\n </div>\n</div>\n" } [/block] --- [block:html] { "html": "<div class='div-middle'> \n <a href='#'>\n Top page &spades; </div>\n </a>\n</div>\n\n<div class='div-back'> \n <a href='/v1.0/docs/data-import'>\n &laquo; Back \n </a>\n</div>\n\n<div class='div-forward'> \n <a href='/v1.0/docs/list-all-imported-files'>\n Next &raquo; </div>\n </a>\n</div>\n\n<style>\n\t.div-back {\n \tpadding-left: 15px;\n\t\tmargin-top: -20px;\n }\n \n .div-middle {\n \ttext-align: center;\n\t\tmargin-top: -15px;\n }\n \n .div-forward {\n \tfloat: right;\n padding-right: 15px;\n\t\tmargin-top: -20px;\n }\n</style>" } [/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 }}