FX Reports API
Introduction
fxreports provides a server based API that allows you to work with your report data in PDF format.
The maximum number of requests is 25 per minute. |
Required JSON Data Pairs
Name | Description | Example |
---|---|---|
templateID |
Report template identifier |
|
sobjectId |
sObject from which the report is built |
|
token |
A valid access token from a bearer token request |
See token example. |
id |
A valid Salesforce login identifier |
See id example. |
instance |
Your org domain |
|
Endpoints
The FXReports API provides several endpoints for working with PDFs.
App | URL | Example | ||
---|---|---|---|---|
/info |
Returns information about the template and the sObject. |
|
||
/handlebars |
Review markup after handlebars syntax has been applied |
|||
/deepload |
See template with data loaded |
|||
/render |
Render the PDF file, such as to save locally |
Token Request
A token is required to utilize the API.
curl -X POST -F "grant_type=password" -F
"client_id=3XXX9A2xX3Xx17xx6xxxX0XXxxF08kKNujly9Ab8N5e_J8xXXX2d8j3XXxXxXXcewrlXxX6LkgXXXbg2dXXX"
-F "client_secret=1234567890123456789" -F "username=myuser@mydomain.com"
-F "password=xxxxxxxxx"
https://login.salesforce.com/services/oauth2/token
The resulting output would look something like:
{
"access_token":"00Di0000000el2B!AQUAQLLek33PetX4xxXxXX6XxXXXbXX8XX6Xx0xXx.xx5fXX4XXxOxx8xX9I88Xx.xx52xxxO7X_T3XXuXXxXXXqu1X5xXXX",
"instance_url":"https://xx00.salesforce.com",
"id":"https://login.salesforce.com/id/00Xi0000000xl2XXXX/009x0000001XXxxXXX",
"token_type":"Bearer",
"issued_at":"1234123412341",
"signature":"XX2xxx..."
}
Merge Endpoint
You can combine multiple items into one PDF file with the /merge
endpoint.
curl -X POST -H "Content-Type: application/json" -d '{ "files":[{ "type": "image", "id":"00X1X000001X1xx"}, {"type":"image", "id":"00P1X000001X1xx"}, {"type":"attachment", "id":"00PS0000003Xx6x"}] "token":"XXXXXC5XAkYJ30XxXxnXXXXX7XxXxoV118xxx9avg5XX3u7xXXxXXoXxX.XXXXXnXXXxXX_G23xX9f9XX12Xxx.oT9xxxxxx", "id":"https://test.salesforce.com/id/00D1F000000X7x8XXX/0051F000002x8xxXXX", "instance":"https://xxxx-xxxxx-0000.xx00.my.salesforce.com"}' https://fxreports.herokuapp.com/merge > test.pdf