Authentication Examples

Creating a User using Internal authentication

Request:

POST https://api.staging.milkbooks.com/user HTTP/1.1
Content-Type: application/json
Accept: application/json
X-MILK-Api-Key: 12345678-1234-1234-1234-123456789012
Host: api.staging.milkbooks.com
Content-Length: 58
{"EmailAddress":"test3@example.com","Password":"test1234"}

Response:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ServiceStack/3.938 Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 18 Jul 2013 00:11:54 GMT
Content-Length: 44
{"Id":33,"EmailAddress":"test3@example.com"}

Creating A Token

Request:

POST https://api.staging.milkbooks.com/token HTTP/1.1
Content-Type: application/json
Accept: application/json
X-MILK-Api-Key: 12345678-1234-1234-1234-123456789012
Host: api.staging.milkbooks.com
Content-Length: 58
{"EmailAddress":"test3@example.com","Password":"test1234"}

Response:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ServiceStack/3.938 Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 18 Jul 2013 00:12:33 GMT
Content-Length: 223
{"Token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I"}

Creating an Anonymous User using Internal authentication

Request:

POST https://api.staging.milkbooks.com/user/anonymous HTTP/1.1
Content-Type: application/json
Accept: application/json
X-MILK-API-Key: 12345678-1234-1234-1234-123456789012
Host: api.staging.milkbooks.com
Content-Length: 0

Response:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/8.0
X-Powered-By: ServiceStack/3.956 Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 30 Apr 2014 04:30:56 GMT
Content-Length: 247
{"Token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuZGV2Lm1pbGtib29rc3dlYnNpdGUuZWlkLmNvLm56IiwiYXVkIjoiYXBpLmRldi5taWxrYm9va3N3ZWJzaXRlLmVpZC5jby5ueiIsImV4cCI6MTM5ODg2ODI1Niwic3ViIjoiMzUifQ.7CzTD-zLBF4WdwJa9UMSHICS97rt1weWcEMJYwFJhpM"}