Library Examples

Uploading an image to the Library (using Push, creating an Anonymous User)

Request:

POST https://api.staging.milkbooks.com/library/push HTTP/1.1
Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
Accept: application/json
X-MILK-API-Key: 12345678-1234-1234-1234-123456789012
Host: api.staging.milkbooks.com
Content-Length: 208
---------------------------acebdf13572468
Content-Disposition: form-data; name="image"; filename="Lighthouse.jpg"
Content-Type: image/jpeg
JPEG DATA
---------------------------acebdf13572468--

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.956 Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 02 May 2014 01:20:36 GMT
Content-Length: 266
{"LibraryItem":{"ItemGuid":"429a491ec7da46e68b224372025a5aa8","FileMimeType":"image/jpeg","FileSize":561276,"FileMd5":"8969288F4245120E7C3870287CCE0FF3"},"ProductBuilderUrl":"https://checkout.staging.milkbooks.com/builder/start/4a45ed53-7944-4639-8dbe-f8cbe3d7e885"}

Uploading an image to the Library (using Pull, creating an Anonymous User)

Request:

POST https://api.staging.milkbooks.com/library/pull 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: 56
{"Url":"http://r0k.us/graphics/kodak/kodak/kodim05.png"}

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.956 Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 02 May 2014 01:35:12 GMT
Content-Length: 265
{"LibraryItem":{"ItemGuid":"99b10a638f664be1911b367954af7320","FileMimeType":"image/png","FileSize":785610,"FileMd5":"B79782844DAE1E15AA9419C502A84F0A"},"ProductBuilderUrl":"https://checkout.staging.milkbooks.com/builder/start/d9795a55-4ed3-49de-9500-bb2f3bf2fbdf"}

Uploading multiple images to the Library at once (using Multi Push, creating an Anonymous User)

Request:

POST https://api.staging.milkbooks.com/library/multi/push HTTP/1.1
Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
Accept: application/json
X-MILK-API-Key: 12345678-1234-1234-1234-123456789012
Host: api.staging.milkbooks.com
Content-Length: 371
---------------------------acebdf13572468
Content-Disposition: form-data; name="fieldNameHere"; filename="Hydrangeas.jpg"
Content-Type: image/jpeg
JPEG DATA
---------------------------acebdf13572468
Content-Disposition: form-data; name="fieldNameHere"; filename="Lighthouse.jpg"
Content-Type: image/jpeg
JPEG DATA
---------------------------acebdf13572468--

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.956 Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 16 Jun 2014 02:52:11 GMT
Content-Length: 426
{"LibraryItems":[{"ItemGuid":"c087c127882249f09658414d9a3e2b4c","FileMimeType":"image/jpeg","FileSize":331295,"FileMd5":"9872F113F67ECE0EFE6C52E23667C9F6"},{"ItemGuid":"56a51dfa56f0484abc645c7d2e70ac5d","FileMimeType":"image/jpeg","FileSize":621594,"FileMd5":"6DE7B5D17C7B3B54425273ACA8536536"}],"ProductBuilderUrl":"https://checkout.staging.milkbooks.com/builder/start/431121ac-7812-4dc5-8ce6-f5ac287107da"}

Uploading multiple images to the Library at once (using Multi Pull, creating an Anonymous User)

Request:

POST https://api.staging.milkbooks.com/library/multi/pull 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: 166
{"Urls":["http://r0k.us/graphics/kodak/kodak/kodim05.png","http://res1.windows.microsoft.com/resbox/en/windows%207/main/76e5d259-30f3-42cd-8e62-6b81c8f11e5e_12.jpg"]}

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.956 Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 17 Jun 2014 02:49:21 GMT
Content-Length: 426
{"LibraryItems":[{"ItemGuid":"6d4f678982c64c6cac953d5fcb5b5110","FileMimeType":"image/jpeg","FileSize":595284,"FileMd5":"AEA9579244EA19614AF4969BDC64BC8A"},{"ItemGuid":"f447cdc19294496faf257eb0f55a2f29","FileMimeType":"image/jpeg","FileSize":561276,"FileMd5":"E7843CB1CA9EFC98E9B6F43AE2A80028"}],"ProductBuilderUrl":"https://checkout.staging.milkbooks.com/builder/start/216c1b8d-a3b9-47d0-8ee8-d755f29ef093"}