REST API

You can get the API_KEY from your account.


Example
format JSON XML
This is the most basic and simple way to use the transform service!
1
2
3
4
5
6
curl -H "Authorization: API_KEY" \
https://api.prexview.com/v1/transform \
-F json="<data.json" \
-F template="template-name" \
-F output="pdf" \
-o result.pdf
You can also use a string instead of a file with curl
1
-F json="{\"hello\":\"World\"}" \
This is the most basic and simple way to use the transform service!
1
2
3
4
5
6
curl -H "Authorization: API_KEY" \
https://api.prexview.com/v1/transform \
-F xml="<data.xml" \
-F template="template-name" \
-F output="pdf" \
-o result.pdf
You can also use a string instead of a file with curl
1
-F xml=" <hello>world</hello>" \
 

Options

 
NameRequiredDescription
xml / jsonYesData to transform in XML or JSON format
outputYesType of document that will be created by PrexView service, it must be html, pdf, png or jpg.
templateYesTemplate’s name to use for the document creation, you can use dynamic values.
templateBackupNoTemplate’s name to use if the template option doesn’t exist
noteNoCustom note that can be used to add any information, it’s limit up to 500 chars. This is useful if you want to add metadata such as document, transaction or customer ID. You can use dynamic values.
 

 

Response headers

 
NameDescription
Content-TypeHTMLtext/html; charset=utf-8
PDFapplication/pdf
PNGimage/png
HTMLimage/jpeg
Content-LengthResponse content length
X-RateLimit-LimitTransaction total limit
X-RateLimit-RemainingReamaining transactions
X-RateLimit-ResetRemaining transaction will be reset at this unix timestamp
x-transaction-idTransaction ID
 

 

HTTP Responses

 
CodeNameDescription
200OKSuccessful HTTP requests. The response will contain an entity corresponding to the requested resource.
400Bad RequestThe server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax or size too large.)

In the response body will be the error details
1
2
3
4
5
6
{
"error": {
"message": "Error message...",
"statusCode": 400
}
}
404Not FoundThe requested resource could not be found but may be available in the future.
429Too Many RequestsThe user has sent too many requests in a given amount of time. Use X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset as reference.
500Internal Server ErrorAn unexpected condition was encountered and no more specific message is suitable.
 

 

Dynamic values

 
You can use json sintax here to access data and have dynamic template names and notes

Example
format JSON XML
1
2
3
4
5
{
"Data": {
"customer": "123"
}
}
Template name can use any data attribute or text node
1
invoice-customer-{{Data.customer}}
We will translate that to the following
1
invoice-customer-123
1
<Data customer="123"></Data>
Template name can use any data attribute or text node
1
invoice-customer-{{Data._customer}}
We will translate that to the following
1
invoice-customer-123
And finally the service will try to find the template invoice-customer-123 in order to transform the data and generate the document.