{"_id":"579b2dae86275519004337f3","__v":1,"githubsync":"","user":"5795d43eb9ee2d0e00df357a","category":{"_id":"579b22d3f4ad7b190094b60e","project":"56e29a8dd3b68d0e00b48ffa","__v":0,"version":"56e29a8dd3b68d0e00b48ffd","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-07-29T09:33:07.078Z","from_sync":false,"order":1,"slug":"accounts","title":"Accounts"},"parentDoc":null,"project":"56e29a8dd3b68d0e00b48ffa","version":{"_id":"56e29a8dd3b68d0e00b48ffd","hasReference":true,"project":"56e29a8dd3b68d0e00b48ffa","__v":15,"hasDoc":true,"createdAt":"2016-03-11T10:14:37.460Z","releaseDate":"2016-03-11T10:14:37.460Z","categories":["56e29a8ed3b68d0e00b48ffe","56eb917a2e58011700afdfcc","56eb92252109011700f3ba5e","5704d4af849f721900f27835","57052a31473f900e004d5d54","5715222811537f19006aab2d","5715b57b810df00e00cc7832","5715baa9810df00e00cc7837","57180ed83a17770e009a7322","571810273a17770e009a7325","579b22d3f4ad7b190094b60e","584538ecba4f1c0f0096925e","586bb88e5602870f00ae7177","5a70407fb0a01400369583c5","5ace359e40606a0003eac1de"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-29T10:19:26.845Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"<?php\n// Example assumes Composer is in use with GuzzleHttp as the API library.\nrequire_once(\"vendor/autoload.php\");\nuse GuzzleHttp\\Client;\n\n// Production environment endpoint\n// $api_base_uri = 'https://api.single-invoice.co/v2.0';\n\n// Sandbox environment endpoint\n$api_base_uri = 'https://api-demo.single-invoice.co/v2.0';\n\n// Create a client and provide a base URL\n$client = new Client(\n\t[ \n\t'timeout' \t=> 4.0,\n\t'verify'\t=> true,\n\t'debug'\t\t=> true\n\t]\n);\n\ntry \n{\n\t$response = $client->request('POST', $api_base_uri.\"/Account/Login\", [\n\t\t'json' \t=> \t[ \n\t\t\t\t\t\t'email' => 'test:::at:::example.com',\n\t\t\t\t\t\t'password' => 'dsj19jfdnnm134419ahf'\n\t\t\t\t\t] \n\t\t]);\n\n\t// Check the status code returned by the call\n\t$statusCode = $response->getStatusCode();\n\n\t// Get the data\n\t$data = json_decode($response->getBody(), true);\n}\ncatch (GuzzleHttp\\Exception\\ClientException $e) \n{\n\t$response = $e->getResponse();\n\t$responseBodyAsString = $response->getBody()->getContents();\n}","language":"php"},{"code":"using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\n\nnamespace Armadillio_Test\n{\n    class Login\n    {\n        public string email { get; set; }\n        public string password { get; set; }\n    }\n\n    class UserDetails\n    {\n        public string Id { get; set; }\n        public string FirstName { get; set; }\n        public string LastName { get; set; }\n        public string Company { get; set; }\n        public string Phone { get; set; }\n        public string Address { get; set; }\n        public string SIREN { get; set; }\n        public string Roles { get; set; }\n        public string Active { get; set; }\n    }\n\n    class Program\n    {\n        static void Main()\n        {\n            RunAsync().Wait();\n        }\n\n        static async Task RunAsync()\n        {\n            using (var client = new HttpClient())\n            {\n                client.BaseAddress = new Uri(\"https://api-demo.single-invoice.co/v2.0/\");\n                client.DefaultRequestHeaders.Accept.Clear();\n                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application/json\"));\n\n                // make the POST request with the suppled variables serialised into JSON\n                var loginrun = new Login() { email = \"test@example.com\", password = \"r3lK0nFHYelG\" };\n                HttpResponseMessage response = await client.PostAsJsonAsync(\"Account/Login\", loginrun);\n\n                if (response.IsSuccessStatusCode)\n                {\n                    // Deserialise the JSON response\n                    UserDetails user = await response.Content.ReadAsAsync<UserDetails>();\n\n                    // Display the account details\n                    Console.WriteLine(user.Id);\n                    Console.WriteLine(user.FirstName + \" \" + user.LastName) ;\n                    Console.WriteLine(user.Company);\n                    Console.WriteLine(user.Phone);\n                    Console.WriteLine(user.Address);\n                    Console.WriteLine(user.SIREN);\n                    Console.WriteLine(user.Roles);\n                    Console.WriteLine(user.Active);\n                }\n                else\n                {\n                    // Handle the error code.\n                    Console.WriteLine((int)response.StatusCode);\n                    Console.WriteLine(response.StatusCode);\n                }\n            }\n        }\n    }\n}","language":"csharp"},{"code":"// Example assumes the packages request and request-promise have been installed (npm install request request-promise)\nvar rp = require('request-promise');\n\nvar apiBaseUri = 'https://api.armadill.io/v2.0';\n\nrp({\n  method: 'POST',\n  uri: apiBaseUri + '/account/login',\n  json: {\n    email: 'test@example.com',\n    password: 'exampleSecurePassword123!@#'\n  }\n})\n  .then(function (res) {\n    // request succeeded, the result is available in the res object\n    console.log(res);\n  })\n  .catch(function (err) {\n    // request failed, the error is available in the err object\n    console.log(err);\n  })\n;\n","language":"javascript"}]},"method":"post","results":{"codes":[{"name":"","code":"{\n    \"Id\": 4817517,\n    \"Email\": \"test@example.com\",\n    \"Packages\": {\n        \"Account\": [\n\t\t\"8v32JuRR06wVV9YPc7gssWMGCRdmq1DElQLNDVZwWBijURhzAAFURbDIFb3aq16K\",\n          ]\n    }\n    \"firstname\": 'Updated Test',\n    \"lastname\": 'Updated Example',\n    \"company\": 'Updated Example.com',\n    \"phone\": '+44-7500-000-000',\n    \"address\": '123 Test Street, London, UK',\n  \t\"industry\" : null,\n    \"roles\": \"User\",\n    \"active\": true\n}","language":"json","status":200},{"name":"","code":"{\n  \"options.Password\" : \n  { \n    \"_errors\" : [\n    \t{ \n      \t\"<Exception>k__BackingField\" : null,\n      \t\"<ErrorMessage>k__BackingField\" : \"The Password field is required.\"\n      }\n    ],\n    \t\"<Value>k__BackingField\":null\n  }\n}","language":"json","status":400},{"code":"{ \n\t\"Code\" : 401,\n\t\"Message\" : \"Username or password incorrect.\"\n}","language":"json","status":401}]},"settings":"","auth":"required","params":[{"_id":"579b2dae86275519004337f5","ref":"","in":"body","required":true,"desc":"Account email address","default":"","type":"string","name":"email"},{"_id":"579b2dae86275519004337f4","ref":"","in":"body","required":true,"desc":"Account password.","default":"","type":"string","name":"password"}],"url":"/account/login"},"isReference":true,"order":2,"body":"","excerpt":"Login to the Single-Invoice.co API.","slug":"login","type":"endpoint","title":"Login"}