Code examples
Here you have some code examples in several programming languages illustrating how you can write your own applicationes over epubli's API. The partner:demo and key:demo combination is used in the examples needing authentication.
HTML / PHP
Obtaining information about a book
In this example we request information about a book we want to create: product ID 1 (90g white paper, DIN A4, hardcover), 35 pages, printed in color. One of the most important values in this case is the final price of the book, which is included in the response received with this example.
As detailed in the product properties query, this example only works using the POST method. If you try using the GET method, it will be rejected.
After sending the POST request you shall receive an answer with information regarding the product you asked for. In the case of this example it should be something like this:
Python
Obtaining information about a book
In this example we request information about a book we want to create: product ID 61 (90g white paper, square format, hardcover), 150 pages, printed in black and white. One of the most important values in this case is the final price of the book, which is included in the response received with this example.
As detailed in the product properties query, this example only works using the POST method. If you try using the GET method, it will be rejected.
After sending the POST request you shall receive an answer with information regarding the product you asked for. In the case of this example, it should output something like this:
Java
Obtaining information about a book
In this example we request information about a book we want to create: product ID 183 (90g white paper, kids book format, softcover), 200 pages, printed in color. One of the most important values in this case is the final price of the book, which is included in the response received with this example.
As detailed in the product properties query, this example only works using the POST method. If you try using the GET method, it will be rejected.
After sending the POST request you shall receive an answer with information regarding the product you asked for. In the case of this example the program will output this into the console: