Joliprint REST API Documentation


The Joliprint API allows third-party applications to turn URLs into Joliprint PDF.

Getting Started


Request Structure

the Joliprint REST API requests can be divided in 4 parts:

  1. Server (required) :
    http://api.joliprint.com
  2. Common path (required) :
    /api/rest/url
  3. Method (required) :
    print, xml, json, jpg, text
  4. App Settings (recommended) :
    /s/foo

Note : foo is a name of your application. This parameter is important for further analytics reports and it is also important that you choose a name according to the name of your application but please do not use foo.

Notes

  • URLs should be URL-encoded. You can’t include a url in the request with  ’&’, ‘?’, ‘#’, ‘ ‘, or other reserved parameters without encoding it.
  • Avoid spaces: any url with spaces will be rejected. All spaces should be either percent encoded (%20) or plus encoded (+). Note that tabs, newlines and trailing spaces are all indications of errors. Please remember to strip leading and trailing whitespace from any user input before shortening.

Examples
You want to convert the URL http://bit.ly/fFZ8u0 to a PDF:

  • http://api.joliprint.com/api/rest/url/print/s/foo?url=http://bit.ly/fFZ8u0

App Settings

The App Settings parameter is optional.

An application can send both anonymous and / or signed requests to Joliprint. We recommend to add the App name parameter in the requests so Joliprint can provide accurate analytics reports.


REST API

No user key or authentication are required to use the API.

The only thing you need is :

  1. Choose a server based on your server location.
  2. Call a method (print, xml, json, jpg, text)
  3. Feed the method with a URL

/url/print

/url/print turns a URL into a PDF document.

Parameter

  • url (required): the URL to turn into PDF.

Output

  • A PDF document.

Example

  • Url to convert: http://lifehacker.com/5706937/dont-make-important-decisions-until-your-decision-time
  • Url to convert (encoded): http%3A%2F%2Flifehacker.com%2F5706937%2Fdont%2Dmake%2Dimportant%2Ddecisions%2Duntil%2Dyour%2Ddecision%2Dtime
  • Get the PDF from the API: http://api.joliprint.com/api/rest/url/print/s/foo?url=http%3A%2F%2Flifehacker.com%2F5706937%2Fdont%2Dmake%2Dimportant%2Ddecisions%2Duntil%2Dyour%2Ddecision%2Dtime

/url/xml

/url/xml returns a structured XML document that describes the PDF attributes.

Parameter

  • url (required): the URL to turn into PDF.

Output

  • status_code: indicates wether the request succeeded or failed:
    • 200 : Success. Everything is right
    • 500 : Fail. An error occured
  • status_text: the status_code label:
    • 200 : OK
    • 500 : the error message
  • title: webpage title
  • filename: PDF file name
  • size: PDF size in bytes.
  • lastmodified: last modification date in milliseconds.
  • url: PDF long url.
  • shorturl: PDF short url.
  • preview: PDF thumbnail (JPG).

Example

  • Get the XML informations:
  • http://api.joliprint.com/api/rest/url/xml/s/foo?url=http%3A%2F%2Flifehacker.com%2F5706937%2Fdont%2Dmake%2Dimportant%2Ddecisions%2Duntil%2Dyour%2Ddecision%2Dtime
    <?xml version="1.0" encoding="UTF-8"?>
    <response>
      <status_code>200</status_code>
      <status_text>OK</status_text>
      <data>
        <title>Don't Make Important Decisions Until Your "Decision Time"</title>
        <filename>lifehacker.com-don-t-make-important-decisions-until-your-decision-time-.pdf</filename>
        <size>267384</size>
        <lastmodified>1291750695000</lastmodified>
        <url>http://api.joliprint.com/api/rest/url/print?url=http%3A%2F%2Flifehacker.com%2F5706937%2Fdont-make-important-decisions-until-your-decision-time</url>
        <shorturl>http://prin.tt/hnT5RN</shorturl>
        <preview>http://api.joliprint.com/api/rest/url/jpg?url=http%3A%2F%2Flifehacker.com%2F5706937%2Fdont-make-important-decisions-until-your-decision-time</preview>
      </data>
    </response>

/url/json

/url/json returns a structured JSON document that describes the PDF.

Parameter

  • url (required): the URL to turn into PDF.

Output

  • status_code: indicates wether the request succeeded or failed:
    • 200 : Success. Everything is right
    • 500 : Fail. An error occured
  • status_text: the status_code label:
    • 200 : OK
    • 500 : the error message
  • title: webpage title
  • filename: PDF file name
  • size: PDF size in bytes.
  • lastmodified: last modification date in milliseconds.
  • url: PDF long url.
  • shorturl: PDF short url.
  • preview: PDF thumbnail (JPG).

Example

  • Get the JSON informations: http://api.joliprint.com/api/rest/url/json/s/foo?url=http%3A%2F%2Flifehacker.com%2F5706937%2Fdont%2Dmake%2Dimportant%2Ddecisions%2Duntil%2Dyour%2Ddecision%2Dtime
    {
      "status_code":"200",
      "status_txt":"OK",
      "data":
      {
        "shorturl":"http://prin.tt/hnT5RN",
        "title":"Don't Make Important Decisions Until Your \"Decision Time\"",
        "preview":"http://api.joliprint.com/api/rest/url/jpg?url=http%3A%2F%2Flifehacker.com%2F5706937%2Fdont-make-important-decisions-until-your-decision-time",
        "lastmodified":"1291750695000",
        "filename":"lifehacker.com-don-t-make-important-decisions-until-your-decision-time-.pdf",
        "url":"http://api.joliprint.com/api/rest/url/print?url=http%3A%2F%2Flifehacker.com%2F5706937%2Fdont-make-important-decisions-until-your-decision-time",
        "size":"267384"
      }
    }

/url/jpg

/url/jpg returns a JPEG image (thumbnail) of the PDF’s firt page.

Parameter

  • url (required): the URL to turn into PDF.

Output

  • A JPEG image.

Example

  • Url to convert: http://lifehacker.com/5706937/dont-make-important-decisions-until-your-decision-time
  • Url to convert (encoded): http%3A%2F%2Flifehacker.com%2F5706937%2Fdont%2Dmake%2Dimportant%2Ddecisions%2Duntil%2Dyour%2Ddecision%2Dtime
  • Get the thumbnail from the API: http://api.joliprint.com/api/rest/url/jpg/s/foo?url=http%3A%2F%2Flifehacker.com%2F5706937%2Fdont%2Dmake%2Dimportant%2Ddecisions%2Duntil%2Dyour%2Ddecision%2Dtime

/url/text/

/url/text/ returns the PDF shorten URL.

Parameter

  • url (required): the URL to turn into PDF.

Output

  • A short URL.

Example

  • Url to convert : http://lifehacker.com/5706937/dont-make-important-decisions-until-your-decision-time
  • Url to convert (encoded): http%3A%2F%2Flifehacker.com%2F5706937%2Fdont%2Dmake%2Dimportant%2Ddecisions%2Duntil%2Dyour%2Ddecision%2Dtime
  • Get the short URL from the API: http://api.joliprint.com/api/rest/url/text/s/foo?url=http%3A%2F%2Flifehacker.com%2F5706937%2Fdont%2Dmake%2Dimportant%2Ddecisions%2Duntil%2Dyour%2Ddecision%2Dtime