{"__v":18,"_id":"54fdffe5f7b1202100a25e0e","category":{"__v":12,"_id":"54fdff31f7b1202100a25e06","pages":["54fdff6bf7b1202100a25e07","54fdff85f7b1202100a25e09","54fdffa1f7b1202100a25e0b","54fdffc25de33c2d0031127a","54fdffe5f7b1202100a25e0e","550199dc0459bd3700770d87","5501d14df2ef1e0d003116ba","5501d1e70459bd3700770e1c","5501d1f4f2ef1e0d003116bd","5501d20f0459bd3700770e1e","5501d2220459bd3700770e20","5501ecbaf2ef1e0d0031171d"],"project":"54d0fd1d095c470d00d1646d","version":"54d0fd1e095c470d00d16470","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-03-09T20:14:41.719Z","from_sync":false,"order":1,"slug":"tutorials","title":"Tutorials"},"project":"54d0fd1d095c470d00d1646d","user":"54db5301eb78f13900cf108b","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-03-09T20:17:41.451Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"In this tutorial you'll find the main ways to create a database inside **goGeo** platform. This tutorial contains two sections:\n\n1. [Creating a Database by Console](/v1.0/docs/creating-a-database#creating-a-database-by-console);\n2. [Creating a Database by API](/v1.0/docs/creating-a-database#creating-a-database-by-api).\n\nIn the first section you'll find how to creating a database using the Console. The next section shows how to do the same task using the API endpoints.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Creating a Database by Console\"\n}\n[/block]\nIn the Console, click on the **Databases** item on the left side menu of the console to enter the database management screen. Then press the **[+]** button located on the upper left corner of the box, as shown in Figure 1:\n[block:image]\n{\n  \"images\": [\n    {\n      \"caption\": \"Figure 1 - Creating a new database.\",\n      \"image\": [\n        \"https://files.readme.io/RyMB71ESCJRB8zbsDSGA_001_fig02.png\",\n        \"001_fig02.png\",\n        \"825\",\n        \"535\",\n        \"#de1c18\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYou'll see the form shown in Figure 2 in which you should fill out with the information of the new database to be created. Enter a name for the database (e.g. **tutorial**), optionally enter a description. The database name must start with a letter and may only contain letters, numbers and the underscore as a separator. You will be informed if it does not meet the validation rules. Click on the button **[Create Database]** to confirm.\n[block:image]\n{\n  \"images\": [\n    {\n      \"caption\": \"Figure 2 - Filling information of new database.\",\n      \"image\": [\n        \"https://files.readme.io/3CAf8cjQQZqU0Wzmi5bF_001_fig03.png\",\n        \"001_fig03.png\",\n        \"798\",\n        \"421\",\n        \"#4388c7\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nFinish. Now its time to create your Collections.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Creating a Database by API\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"NOTE\",\n  \"body\": \"You need to create an account to get your own API-KEY.\"\n}\n[/block]\nTo create your own database via API, you will first need your API-KEY. You will need to get in the Console.\n\nWith the API-KEY in hands, you just need do a POST request. You can do this using cURL tool.\n\n### cURL\nOpen a terminal;\n\nExecuting the follow command:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -k --user {apikey}: -H \\\"Content-Type: application/json\\\" \\\\\\n  -X POST https://api.gogeo.io/1.0/databases -d '\\n    {\\n      \\\"database_name\\\": \\\"{database_name}\\\"\\n    }'\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nThis will create a database. Just replace *{apikey}* by your own API-KEY, and *{database_name}* by the name you want.\n\nCongratulations, you already have your database created.\n\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/cloning-shared-collection'>\\n    &laquo; Back \\n  </a>\\n</div>\\n\\n<div class='div-forward'> \\n  <a href='/v1.0/docs/creating-a-collection'>\\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":"","slug":"creating-a-database","type":"basic","title":"Creating a database"}

Creating a database


In this tutorial you'll find the main ways to create a database inside **goGeo** platform. This tutorial contains two sections: 1. [Creating a Database by Console](/v1.0/docs/creating-a-database#creating-a-database-by-console); 2. [Creating a Database by API](/v1.0/docs/creating-a-database#creating-a-database-by-api). In the first section you'll find how to creating a database using the Console. The next section shows how to do the same task using the API endpoints. [block:api-header] { "type": "basic", "title": "Creating a Database by Console" } [/block] In the Console, click on the **Databases** item on the left side menu of the console to enter the database management screen. Then press the **[+]** button located on the upper left corner of the box, as shown in Figure 1: [block:image] { "images": [ { "caption": "Figure 1 - Creating a new database.", "image": [ "https://files.readme.io/RyMB71ESCJRB8zbsDSGA_001_fig02.png", "001_fig02.png", "825", "535", "#de1c18", "" ] } ] } [/block] You'll see the form shown in Figure 2 in which you should fill out with the information of the new database to be created. Enter a name for the database (e.g. **tutorial**), optionally enter a description. The database name must start with a letter and may only contain letters, numbers and the underscore as a separator. You will be informed if it does not meet the validation rules. Click on the button **[Create Database]** to confirm. [block:image] { "images": [ { "caption": "Figure 2 - Filling information of new database.", "image": [ "https://files.readme.io/3CAf8cjQQZqU0Wzmi5bF_001_fig03.png", "001_fig03.png", "798", "421", "#4388c7", "" ] } ] } [/block] Finish. Now its time to create your Collections. [block:api-header] { "type": "basic", "title": "Creating a Database by API" } [/block] [block:callout] { "type": "danger", "title": "NOTE", "body": "You need to create an account to get your own API-KEY." } [/block] To create your own database via API, you will first need your API-KEY. You will need to get in the Console. With the API-KEY in hands, you just need do a POST request. You can do this using cURL tool. ### cURL Open a terminal; Executing the follow command: [block:code] { "codes": [ { "code": "curl -k --user {apikey}: -H \"Content-Type: application/json\" \\\n -X POST https://api.gogeo.io/1.0/databases -d '\n {\n \"database_name\": \"{database_name}\"\n }'", "language": "curl" } ] } [/block] This will create a database. Just replace *{apikey}* by your own API-KEY, and *{database_name}* by the name you want. Congratulations, you already have your database created. --- [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/cloning-shared-collection'>\n &laquo; Back \n </a>\n</div>\n\n<div class='div-forward'> \n <a href='/v1.0/docs/creating-a-collection'>\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]