Data requirements

Understand the data that is necessary to make requests to the Inkit Render API successfully

The primary goal of this topic is to give you a conceptual understanding of what it takes, data-wise, to send a request to the Inkit Render API. After reading, you should be able to tell what data you need from your systems.

Prerequisites:

  • You understand the difference between users and API keys
  • You know what data your systems produce
  • You know what data you need for your to be generated documents

Read more about:

Data requirements

The Inkit Render API is a RESTful API. Meaning you can Create, Read, Update, and Delete documents. However, when you want to use the API, there are data standards to which you must adhere.

First of all, Inkit Render generates PDFs from HTML files. This process requires that the data you want to turn into a document be put into HTML format.

However, to optimize speed and give you faster-generated documents, you must serve the HTML files as base64 encoded strings.

Again, this means you cannot send an entire HTML file as a string to the API. You can only send a base64 encoded HTML string.

Most programming languages have built-in functions to turn a string into a base64 encoded one.
For example, in Javascript, you may use the btoa() function, which accepts a string as input and outputs the base64 result.

In C#, you would use the GetBytes() function on your string and convert it through the Convert.ToBase64String() method.

And likewise, in Java, you would use the Base64 encoder and its encodeToString() method.

With a quick Google search, you will quickly discover how to encode a string in Base64 format for your specific programming language.

JSON body parameters

Besides the HTML string encoding, there are other data parameters you must include in your requests. First of all, when creating PDFs, you must include three other parameters other than the encoded HTML string. They are Unit, Width, and Height.

Unit: the measurement system that you want your document to use. You can choose between inches, centimeters, or pixels.

Width & Height: the dimensions of your document. For example, the US standard letter size of 8.5 by 11 inches.

Other (optional) JSON body parameters

If you wish, you can choose to add more parameters to your request and utilize extra functionalities of the Inkit Render API.

You can read more about these parameters in their designated topics:

The above topics are coming soon.