This page contains an example of executing an end to end order against the API with HTTP level examples.
Creating a User
Request:
POST http://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":"test1@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: Fri, 19 Apr 2013 03:21:46 GMT
Content-Length: 43
{"Id":2,"EmailAddress":"test1@example.com"}
Creating A Session
Request:
POST http://api.staging.milkbooks.com/session 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":"test1@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: Fri, 19 Apr 2013 03:22:04 GMT
Content-Length: 36
{"SessionId":"SWzj84qs39YaFMpkofna"}
Listing Products
Request:
GET http://api.staging.milkbooks.com/products HTTP/1.1
content-type: application/json
accept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
Host: api.staging.milkbooks.com
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: Fri, 19 Apr 2013 03:38:55 GMT
Content-Length: 56
{"Products":[{"Id":101397,"Name":"Japanese Photobook"}]}
Creating A Project
Request:
POST http://api.staging.milkbooks.com/project HTTP/1.1
content-type: application/json
accept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: SWzj84qs39YaFMpkofna
Host: api.staging.milkbooks.com
Content-Length: 42
{"Name":"Test Project","ProductId":101397}
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: Fri, 19 Apr 2013 03:41:35 GMT
Content-Length: 172
{"Guid":"e4a6f2011a1244ca9bfad7227903be4e","Name":"Test Project","ProductId":101397,"CreatedDateUtc":"\/Date(1366342895457)\/","LastSavedDateUtc":"\/Date(1366342895457)\/"}
Listing Projects
Request:
GET http://api.staging.milkbooks.com/projects HTTP/1.1
content-type: application/json
accept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: SWzj84qs39YaFMpkofna
Host: api.staging.milkbooks.com
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: Fri, 19 Apr 2013 03:42:33 GMT
Content-Length: 197
{"Projects":[{"Guid":"e4a6f2011a1244ca9bfad7227903be4e","Name":"Test Project","ProductId":101397,"CreatedDateUtc":"\/Date(1366368095457-0700)\/","LastSavedDateUtc":"\/Date(1366368095457-0700)\/"}]}
Creating A Basket
Request:
POST http://api.staging.milkbooks.com/basket HTTP/1.1
content-type: application/json
accept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: SWzj84qs39YaFMpkofna
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/7.5
X-Powered-By: ServiceStack/3.938 Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 19 Apr 2013 03:43:44 GMT
Content-Length: 131
{"Guid":"30296cecb5f54694923ede68545c6d72","CreatedDateUtc":"\/Date(1366343024282)\/","LastSavedDateUtc":"\/Date(1366343024282)\/"}
Listing Baskets
Request:
GET http://api.staging.milkbooks.com/baskets HTTP/1.1
content-type: application/json
accept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: SWzj84qs39YaFMpkofna
Host: api.staging.milkbooks.com
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: Fri, 19 Apr 2013 03:45:08 GMT
Content-Length: 277
{"Baskets":[{"Guid":"1ef8dc7d86a14454b3b0b880b36c82ff","CreatedDateUtc":"\/Date(1366341815000)\/","LastSavedDateUtc":"\/Date(1366341815000)\/"},{"Guid":"30296cecb5f54694923ede68545c6d72","CreatedDateUtc":"\/Date(1366343024000)\/","LastSavedDateUtc":"\/Date(1366343024000)\/"}]}