Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated examples to use new Token header

This page contains an example of executing an end to end order against the API with HTTP level examples.

Creating a User using Internal authentication

Request:

POST http://api.staging.milkbooks.com/user HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
xX-milkMILK-apiApi-keyKey: 12345678-1234-1234-1234-123456789012
Host: api.staging.milkbooks.com
Content-Length: 58
{"EmailAddress":"test2@exampletest3@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: WedThu, 2618 JunJul 2013 00:2911:1754 GMT
Content-Length: 44
{"Id":3033,"EmailAddress":"test2@exampletest3@example.com"}

Creating A

...

Token

Request:

POST http://api.staging.milkbooks.com/sessiontoken HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
xX-milkMILK-apiApi-keyKey: 12345678-1234-1234-1234-123456789012
Host: api.staging.milkbooks.com
Content-Length: 58
{"EmailAddress":"test2@exampletest3@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: WedThu, 2618 JunJul 2013 00:2912:4033 GMT
Content-Length: 36223
{"SessionIdToken":"aH41qm9/cnNEMCz3CAgseyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I"}

Listing Products With API Key

Request:

GET http://api.staging.milkbooks.com/products HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
xX-milkMILK-apiApi-keyKey: 12345678-1234-1234-1234-123456789012
Host: api.staging.milkbooks.com
Content-Length: 0

...

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: WedThu, 2618 JunJul 2013 00:3015:2006 GMT
Content-Length: 12163
{"Products":[{"Id":106697,"Name":"Japanese Photobook","Price":39.9500},{"Id":108089,"Name":"Test Book","Price":39.9500}]}

...

POST http://api.staging.milkbooks.com/project HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgsAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 42

...

POST http://api.staging.milkbooks.com/project/e92f870a47fa4326b97bb21e074fd540/version/1/artifact/small_cover_sticker HTTP/1.1
Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
acceptAccept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgsAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 238

...

POST http://api.staging.milkbooks.com/project/e92f870a47fa4326b97bb21e074fd540/version/1/artifact/pages HTTP/1.1
Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
acceptAccept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgsAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 224

...

{"Number":1,"IsComplete":true,"Artifacts":[{"Name":"small_cover_sticker","IsComplete":true,"FileMimeType":"application/pdf","FileSize":14,"FileMd5":"05A188351B5848E2FD5B062D80D1A754"},{"Name":"pages","IsComplete":true,"FileMimeType":"application/pdf","FileSize":14,"FileMd5":"05A188351B5848E2FD5B062D80D1A754"}],"CreatedDateTimeUtc":"\/Date(1372231885927)\/","LastSavedDateTimeUtc":"\/Date(1372231885927)\/"}

Listing Projects

Request:

GET http://api.staging.milkbooks.com/projects HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id:
Host: api.staging.milkbooks.com
Content-Length: 0Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
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: Wed, 26 Jun 2013 00:35:01 GMT
Content-Length: 609

...

POST http://api.staging.milkbooks.com/project/e92f870a47fa4326b97bb21e074fd540/version HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgs
Host: api.staging.milkbooks.com
Content-Length: 0Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
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: Wed, 26 Jun 2013 01:17:23 GMT
Content-Length: 293

...

POST http://api.staging.milkbooks.com/basket HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgsAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 0

...

POST http://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5/line HTTP/1.1
content-type: application/json
accept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgsContent-Type: application/json
Accept: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 63

...

{"Line":{"Id":588670,"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":1,"Total":39.95000000},"Basket":{"Guid":"80d968618ae54b4bae699a3b39aaadf5","Lines":[{"Id":588670,"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":1,"Total":39.95000000}],"OrderTotal":39.95000000,"CreatedDateUtc":"\/Date(1372206920000)\/","LastSavedDateUtc":"\/Date(1372206988626)\/"}}

Listing Baskets

Request:

GET http://api.staging.milkbooks.com/baskets HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgsAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 0

...

GET http://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5 HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgsAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 0

...

PUT http://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5/line/588670 HTTP/1.1
contentContent-typeType: application/json
accept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgs
Accept: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 63

...

DELETE http://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5/line/588670 HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgsAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 0

...

POST http://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5/line HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgsAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 63

...

POST http://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5/checkout HTTP/1.1
contentContent-typeType: application/json
accept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgsAccept: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 0

...

{"BasketGuid":"80d968618ae54b4bae699a3b39aaadf5","CheckoutUrl":"http://checkout.api.staging.milkbooks.com/start.aspx?token=3456bbc7-0494-435f-b7da-e37d0e696500"}

 

Retrieve Orders

...

Request:

GET http://api.staging.milkbooks.com/orders HTTP/1.1
contentContent-typeType: application/json
acceptAccept: application/json
x-milk-api-key: 12345678-1234-1234-1234-123456789012
x-milk-session-id: aH41qm9/cnNEMCz3CAgsAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 0

...

{"Orders":[{"OrderGuid":"y92f870fdfgfa4326sdfsdfsdf74fd540",
"Lines":[{"Id":588671,"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":1,"Total":39.95000000}],
"OrderTotal":39.50,"Status":"Processing","CreatedDateUtc":"\/Date(-62135596800000+1300)\/",
"CompletedDateUtc":"\/Date(-62135596800000+1300)\/","LastSavedDateUtc":"\/Date(-62135596800000+1300)\/"}]}

 

...