Basket Examples

Creating A Basket

Request:

POST https://api.staging.milkbooks.com/basket HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: 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:20 GMT
Content-Length: 157
{"Guid":"80d968618ae54b4bae699a3b39aaadf5","Lines":[],"OrderTotal":0,"CreatedDateUtc":"\/Date(1372206920892)\/","LastSavedDateUtc":"\/Date(1372206920892)\/"}

Adding a Project to a Basket (creating a Basket Line)

Request:

POST https://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5/line HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 63
{"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":1}

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:36:28 GMT
Content-Length: 376
{"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 https://api.staging.milkbooks.com/baskets HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: 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:36:52 GMT
Content-Length: 268
{"Baskets":[{"Guid":"80d968618ae54b4bae699a3b39aaadf5","Lines":[{"Id":588670,"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":1,"Total":39.9500}],"OrderTotal":39.9500,"CreatedDateUtc":"\/Date(1372206920000)\/","LastSavedDateUtc":"\/Date(1372206988000)\/"}]}

Getting a Basket (with Lines)

Request:

GET https://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5 HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: 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:38:25 GMT
Content-Length: 256
{"Guid":"80d968618ae54b4bae699a3b39aaadf5","Lines":[{"Id":588670,"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":7,"Total":279.6500}],"OrderTotal":279.6500,"CreatedDateUtc":"\/Date(1372206920000)\/","LastSavedDateUtc":"\/Date(1372207083000)\/"}

Updating a Basket Line Quantity

Request:

PUT https://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5/line/588670 HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 63
{"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":7}

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:38:03 GMT
Content-Length: 379
{"Line":{"Id":588670,"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":7,"Total":279.65000000},"Basket":{"Guid":"80d968618ae54b4bae699a3b39aaadf5","Lines":[{"Id":588670,"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":7,"Total":279.65000000}],"OrderTotal":279.65000000,"CreatedDateUtc":"\/Date(1372206920000)\/","LastSavedDateUtc":"\/Date(1372207083630)\/"}}

Deleting a Basket Line

Request:

DELETE https://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5/line/588670 HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: 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:39:06 GMT
Content-Length: 168
{"Basket":{"Guid":"80d968618ae54b4bae699a3b39aaadf5","Lines":[],"OrderTotal":0,"CreatedDateUtc":"\/Date(1372206920000)\/","LastSavedDateUtc":"\/Date(1372207146747)\/"}}

Add a Basket Line back in

Request:

POST https://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5/line HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuc3RhZ2luZy5taWxrYm9va3MuY29tIiwiYXVkIjoiYXBpLnN0YWdpbmcubWlsa2Jvb2tzLmNvbSIsImV4cCI6MTM3NDE0MjM1Mywic3ViIjoiMzMifQ.CcMJDeRRaASEasdVbac1uqs2WYvnUQSmgt3DnuCYv_I
Host: api.staging.milkbooks.com
Content-Length: 63
{"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":1}

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:40:09 GMT
Content-Length: 376
{"Line":{"Id":588671,"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":1,"Total":39.95000000},"Basket":{"Guid":"80d968618ae54b4bae699a3b39aaadf5","Lines":[{"Id":588671,"ProjectGuid":"e92f870a47fa4326b97bb21e074fd540","Quantity":1,"Total":39.95000000}],"OrderTotal":39.95000000,"CreatedDateUtc":"\/Date(1372206920000)\/","LastSavedDateUtc":"\/Date(1372207209755)\/"}}

Retrieve A Checkout URL

Request:

POST https://api.staging.milkbooks.com/basket/80d968618ae54b4bae699a3b39aaadf5/checkout HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: 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:40:27 GMT
Content-Length: 153
{"BasketGuid":"80d968618ae54b4bae699a3b39aaadf5","CheckoutUrl":"https://checkout.staging.milkbooks.com/start/0c6f80cc-f5a6-4d71-94a4-7fb423c66ab3"}