I have reviewed the available API documentation in preparation for writing utility program for uploading many books to Lulu. I already have PDF documents for all of my books, not Word docs. I will be writing the code that consumes your web services in an existing C# .NET application. Before I begin writing code, I would like for you to help me with overview of what I will need to do. I thank you for your time.
QUESTION: The example code for this service call shows how to upload HTML in POST. How can I upload a PDF file instead? Should I encode the PDF file to Base64 string? What is the proper Content-Disposition and Content-Type to use? Can you point me to example please?
2b) save fileId in response, to pass when creating Project later
The steps you have outlined look exactly correct. I've answered your questions below.
QUESTION: The example code for this service call shows how to upload HTML in POST. How can I upload a PDF file instead? Should I encode the PDF file to Base64 string? What is the proper Content-Disposition and Content-Type to use? Can you point me to example please?
To upload a PDF file, just perform a multipart/form-data POST of the file data. Base64 encoding the file data should not be necessary. The primary Content-type header will be multipart/form-data, with the Content-disposition and Content-type inside the multipart piece should be set as follows:
Most languages should have a library that handles the heavy lifting in performing this type of operation. For example, in Java using apache commons http, it looks like this:
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(targetUrl);
MultipartEntity multipartEntity = new MultipartEntity();
QUESTION: Is this necessary if my PDFs have cover page already?
It is necessary to upload both the interior and the cover as separate files. The interior needs to match the trim size of the book and all pages must be the same dimensions. The cover should be a single page of an appropriate size to wrap around the outside of the book.
Hello,
I have reviewed the available API documentation in preparation for writing utility program for uploading many books to Lulu. I already have PDF documents for all of my books, not Word docs. I will be writing the code that consumes your web services in an existing C# .NET application. Before I begin writing code, I would like for you to help me with overview of what I will need to do. I thank you for your time.
My understanding is that I must:
1) get developer key (done)
2a) upload PDF file to your server via [POST https://transfer.lulu.com/api/create/v1/file]
QUESTION: The example code for this service call shows how to upload HTML in POST. How can I upload a PDF file instead? Should I encode the PDF file to Base64 string? What is the proper Content-Disposition and Content-Type to use? Can you point me to example please?
2b) save fileId in response, to pass when creating Project later
3a) upload cover page via [POST https://apps.lulu.com/api/create/v1/coverconversion?api_key={your api key}&auth_token={authentication token}]
QUESTION: Is this necessary if my PDFs have cover page already?
3b) save outputFileId in Cover Conversion Status response, to pass when creating Project later
4a) create project via [POST https://apps.lulu.com/api/publish/v1/create] with POST argument using JSON representation of Project, with fileIds for PDF and Cover.
4b) save content_id in response for future reference
Thank you, Katrinka
Message edited by Katrinka 1 year ago
Josiah Gore – 2 years ago
The steps you have outlined look exactly correct. I've answered your questions below.
QUESTION: The example code for this service call shows how to upload HTML in POST. How can I upload a PDF file instead? Should I encode the PDF file to Base64 string? What is the proper Content-Disposition and Content-Type to use? Can you point me to example please?
To upload a PDF file, just perform a multipart/form-data POST of the file data. Base64 encoding the file data should not be necessary. The primary Content-type header will be multipart/form-data, with the Content-disposition and Content-type inside the multipart piece should be set as follows:
Most languages should have a library that handles the heavy lifting in performing this type of operation. For example, in Java using apache commons http, it looks like this:
QUESTION: Is this necessary if my PDFs have cover page already?
It is necessary to upload both the interior and the cover as separate files. The interior needs to match the trim size of the book and all pages must be the same dimensions. The cover should be a single page of an appropriate size to wrap around the outside of the book.
Katrinka – 2 years ago
Josiah,
Thank you very much! I will follow your helpful advice.
Katrinka
bathroomfloor – 1 year ago
For this you can use adobe pdf converter....Bathroom Tile Ideas