{"__v":1,"_id":"5719767ec863120e0012a05c","category":{"__v":0,"_id":"5719767ec863120e0012a044","project":"56008ba98c0c9d0d00dcaeb0","version":"5719767ec863120e0012a042","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-03-03T22:29:05.165Z","from_sync":false,"order":1,"slug":"guides","title":"Guide"},"parentDoc":null,"project":"56008ba98c0c9d0d00dcaeb0","user":"56008b651503430d007cc929","version":{"__v":4,"_id":"5719767ec863120e0012a042","hasDoc":true,"hasReference":true,"project":"56008ba98c0c9d0d00dcaeb0","createdAt":"2016-04-22T00:55:26.295Z","releaseDate":"2016-04-22T00:55:26.295Z","categories":["5719767ec863120e0012a043","5719767ec863120e0012a044","5719767ec863120e0012a045","5719767ec863120e0012a046","5719767ec863120e0012a047","5719767ec863120e0012a048","5719767ec863120e0012a049","57f45a18da14e71700d12e4a","582b71b15403840f008c0410","58c060cf3eee111b00a8b210"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-03-03T22:35:21.004Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"This guide will get your first event showing up on your ThisData Dashboard. Cool!\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/MjDfqb2DS7mOJ4pAhBQR_Send%20your%20first%20event.png\",\n        \"Send your first event.png\",\n        \"1500\",\n        \"633\",\n        \"\",\n        \"\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nWe'll use a simple command line tool called CURL. If you have a Mac, you'll need to open a program called Terminal.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 1. Sign up for ThisData account\"\n}\n[/block]\n- Head over to ThisData.com, and click Sign Up.\n- Enter your name and email address\n- Head over to your favourite email client, and click the “Confirm Your Email” message that we sent you\n- If you want, put in your Company Name (or a fake one)\n- Enter a password (it’s gonna be strong and unique, right?? RIGHT?!)\n- Badda bing, badda boom - you’re in.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 2. Get your API key\"\n}\n[/block]\nTo get an API Key you need to install the ThisData Login Intelligence integration.\n\n- In the top navigation bar, click “+ Add Integration\"\n- Click on “Login Intelligence API\"\n- Badda bing, bad boom - there’s your API key!\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 3. Send your first event\"\n}\n[/block]\nCopy and paste this into your command line:\n\n```json\ncurl -v -XPOST 'https://api.thisdata.com/v1/events.json?api_key=API_KEY' -d '{\n  \"ip\" : \"1.2.3.4\",\n  \"verb\" : \"log-in\",\n  \"user_agent\" : \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3)...\",\n  \"user\" : {\n    \"id\" : \"112233\",\n    \"name\" : \"Eve Smith\",\n    \"email\" : \"eve.smith:::at:::domain.com\",\n    \"mobile\" : \"+18325552002\"\n   }\n}'\n```\n\n_\"Heyyyy\"_, you say, _\"I’m not gonna just copypaste code I don’t understand!!_ High-five! That’s good developer behaviour. Don’t trust anyone!\n\nWhat the CURL command is doing is sending a [JSON](https://en.wikipedia.org/wiki/JSON) payload to ThisData.com using a POST request, with your API Key as a query parameter.\n\nIt sends it in CURL's verbose mode, so that you can see the successful `200 OK` response, with an empty body.\n\nThe payload is [explained in detail here](http://help.thisdata.com/docs/apiv1events). But in short, it’s the metadata describing an action of one of your users. So, when Eve Smith logs in to your app, you send us that bit of metadata.\n\nUsing the IP address, User Agent, and some magic sauce, ThisData will figure out if this behaviour is normal. And the user part of the event does two things: send out useful and personal “Was this you?” emails when something looks suspicious, and helps us to create nice audit logs for your team.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 4. Check out the Dashboard\"\n}\n[/block]\nFlick back to your favourite browser, and open the ThisData Dashboard tab. You’ll see that Eve Smith has shown up on the dashboard map and stats.\n\nPat yourself on the back, you’ve taken a big step towards better application security!\n\n### Where to from here?\n\nRead through the other guides - try [triggering an alert with cURL](doc:triggering-your-first-alert)!\nOr skip straight to [adding tracking to your app](doc:what-events-should-i-track).\n\n### Need help? Have feedback?\n\nCome talk to us [on Twitter](https://twitter.com/ThisDataAPI), or email: [developers@thisdata.com](mailto:developers@thisdata.com)","excerpt":"This guide will get your first event showing up on your Dashboard. It uses a simple command line tool called CURL.","slug":"sending-your-first-event-to-thisdata-from-the-command-line-with-curl","type":"basic","title":"1. Send your first Event using CURL"}

1. Send your first Event using CURL

This guide will get your first event showing up on your Dashboard. It uses a simple command line tool called CURL.

This guide will get your first event showing up on your ThisData Dashboard. Cool! [block:image] { "images": [ { "image": [ "https://files.readme.io/MjDfqb2DS7mOJ4pAhBQR_Send%20your%20first%20event.png", "Send your first event.png", "1500", "633", "", "" ], "sizing": "full" } ] } [/block] We'll use a simple command line tool called CURL. If you have a Mac, you'll need to open a program called Terminal. [block:api-header] { "type": "basic", "title": "Step 1. Sign up for ThisData account" } [/block] - Head over to ThisData.com, and click Sign Up. - Enter your name and email address - Head over to your favourite email client, and click the “Confirm Your Email” message that we sent you - If you want, put in your Company Name (or a fake one) - Enter a password (it’s gonna be strong and unique, right?? RIGHT?!) - Badda bing, badda boom - you’re in. [block:api-header] { "type": "basic", "title": "Step 2. Get your API key" } [/block] To get an API Key you need to install the ThisData Login Intelligence integration. - In the top navigation bar, click “+ Add Integration" - Click on “Login Intelligence API" - Badda bing, bad boom - there’s your API key! [block:api-header] { "type": "basic", "title": "Step 3. Send your first event" } [/block] Copy and paste this into your command line: ```json curl -v -XPOST 'https://api.thisdata.com/v1/events.json?api_key=API_KEY' -d '{ "ip" : "1.2.3.4", "verb" : "log-in", "user_agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3)...", "user" : { "id" : "112233", "name" : "Eve Smith", "email" : "eve.smith@domain.com", "mobile" : "+18325552002" } }' ``` _"Heyyyy"_, you say, _"I’m not gonna just copypaste code I don’t understand!!_ High-five! That’s good developer behaviour. Don’t trust anyone! What the CURL command is doing is sending a [JSON](https://en.wikipedia.org/wiki/JSON) payload to ThisData.com using a POST request, with your API Key as a query parameter. It sends it in CURL's verbose mode, so that you can see the successful `200 OK` response, with an empty body. The payload is [explained in detail here](http://help.thisdata.com/docs/apiv1events). But in short, it’s the metadata describing an action of one of your users. So, when Eve Smith logs in to your app, you send us that bit of metadata. Using the IP address, User Agent, and some magic sauce, ThisData will figure out if this behaviour is normal. And the user part of the event does two things: send out useful and personal “Was this you?” emails when something looks suspicious, and helps us to create nice audit logs for your team. [block:api-header] { "type": "basic", "title": "Step 4. Check out the Dashboard" } [/block] Flick back to your favourite browser, and open the ThisData Dashboard tab. You’ll see that Eve Smith has shown up on the dashboard map and stats. Pat yourself on the back, you’ve taken a big step towards better application security! ### Where to from here? Read through the other guides - try [triggering an alert with cURL](doc:triggering-your-first-alert)! Or skip straight to [adding tracking to your app](doc:what-events-should-i-track). ### Need help? Have feedback? Come talk to us [on Twitter](https://twitter.com/ThisDataAPI), or email: [developers@thisdata.com](mailto:developers@thisdata.com)