PUT /transformations/html-to-pdf HTML to PDF
transform_html_to_pdf
Performs synchronous format transformation. Transforms HTML to PDF.
Downloads data from the URL and uploads the transformed data to PDF.
Upload is sent with "PUT" with HTTP method.
An example of how to integrate the conversion in the flow.
{
"version": "2",
"authorization": {
"mode": "pass_through",
"auth_type": "custom",
"credentials": "dynamic"
},
"definition": {
"StartAt": "DownloadHTML",
"States": {
"DownloadHTML": {
"Next": "InstantiateBlob",
"Type": "Task",
"ResourceDefinition": {
"Type": "HTTP_ANY",
"HttpMethod": "GET",
"Headers": {
"Accept": "text/html"
},
"VendorEndpointUrlPath": "$.request_payload.source_url",
"SaveResponseToFile": true,
"Extract": {
"Save": {
"download_from_url": "$.response_file_url"
}
}
}
},
"InstantiateBlob": {
"Type": "Task",
"Next": "SaveAsPDF",
"ResourceDefinition": {
"Type": "HTTP_JSON",
"HttpMethod": "POST",
"VendorEndpointUrl": "",
"Headers": {
"Content-Type": "application/json",
"x-api-key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"PathParametersMapping": {
"request_host": "$.request_host"
},
"RequestPayload": {
"extension": ".pdf",
"presign_url_ttl": 3600
},
"Extract": {
"Save": {
"blob_id": "$.blob_id",
"upload_to_url": "$.presigned_urls.upload.url"
}
}
}
},
"SaveAsPDF": {
"Type": "Task",
"Next": "ComposeResponse",
"ResourceDefinition": {
"Type": "HTTP_JSON",
"HttpMethod": "PUT",
"Headers": {
"Content-Type": "application/json",
"x-api-key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"RequestPayload": {
"urls": {
"download_from_url": "$.download_from_url",
"upload_to_url": "$.upload_to_url"
}
},
"VendorEndpointUrl": "",
"PathParametersMapping": {
"request_host": "$.request_host"
}
}
},
"ComposeResponse": {
"End": true,
"Type": "Task",
"ResourceDefinition": {
"Type": "CODE",
"Source": "loopback = lambda response: response",
"Runtime": "python3.8",
"InputDataSelector": {
"blob_id": "$.blob_id"
},
"SaveOutputTo": "response_payload",
"FunctionName": "loopback"
}
}
}
}
}
Note
Subscribe to connection-html-to-pdf component to access this feature.
Show the rest
Upload is sent with "PUT" with HTTP method.
An example of how to integrate the conversion in the flow.
{
"version": "2",
"authorization": {
"mode": "pass_through",
"auth_type": "custom",
"credentials": "dynamic"
},
"definition": {
"StartAt": "DownloadHTML",
"States": {
"DownloadHTML": {
"Next": "InstantiateBlob",
"Type": "Task",
"ResourceDefinition": {
"Type": "HTTP_ANY",
"HttpMethod": "GET",
"Headers": {
"Accept": "text/html"
},
"VendorEndpointUrlPath": "$.request_payload.source_url",
"SaveResponseToFile": true,
"Extract": {
"Save": {
"download_from_url": "$.response_file_url"
}
}
}
},
"InstantiateBlob": {
"Type": "Task",
"Next": "SaveAsPDF",
"ResourceDefinition": {
"Type": "HTTP_JSON",
"HttpMethod": "POST",
"VendorEndpointUrl": "",
"Headers": {
"Content-Type": "application/json",
"x-api-key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"PathParametersMapping": {
"request_host": "$.request_host"
},
"RequestPayload": {
"extension": ".pdf",
"presign_url_ttl": 3600
},
"Extract": {
"Save": {
"blob_id": "$.blob_id",
"upload_to_url": "$.presigned_urls.upload.url"
}
}
}
},
"SaveAsPDF": {
"Type": "Task",
"Next": "ComposeResponse",
"ResourceDefinition": {
"Type": "HTTP_JSON",
"HttpMethod": "PUT",
"Headers": {
"Content-Type": "application/json",
"x-api-key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"RequestPayload": {
"urls": {
"download_from_url": "$.download_from_url",
"upload_to_url": "$.upload_to_url"
}
},
"VendorEndpointUrl": "",
"PathParametersMapping": {
"request_host": "$.request_host"
}
}
},
"ComposeResponse": {
"End": true,
"Type": "Task",
"ResourceDefinition": {
"Type": "CODE",
"Source": "loopback = lambda response: response",
"Runtime": "python3.8",
"InputDataSelector": {
"blob_id": "$.blob_id"
},
"SaveOutputTo": "response_payload",
"FunctionName": "loopback"
}
}
}
}
}
connection-html-to-pdf component to access this feature.Request
{
"urls": {
"download_from_url": "https://staircase.co/html-is-downloaded-from-here",
"upload_to_url": "https://staircase.co/pdf-is-upload-to-here"
}
} Response
Bad request syntax. Request payload does not exist or malformed.
{
"error": {
"message": "Bad Request",
"reason": [
"\"\" is less than 1 character."
]
}
} Request is forbidden, API key is not valid
{
"message": "Your API key is not valid, please refresh it."
} Resource not found. Resource you were looking for was not found.
{
"error": {
"message": "Not Found",
"reason": "Nothing matches the given URI."
}
} A 422 status code occurs when a request is well-formed, however, due to semantic errors it is unable to be processed.
{
"error": {
"message": "Unprocessable entity.",
"reason": "Domain name could not be validated."
}
} Request bodyapplication/json
1 fields
application/json| Field | Type | Description |
|---|---|---|
urlsrequired | object | Container for download and upload URLs. |
download_from_urlrequired | string (uri) | The URL from where connector pulls the HTML data. Must have `https://` in the URLs part. |
upload_to_urlrequired | string (uri) | The URL where connector puts the PDF data. Must have `https://` in the URLs scheme. |
Response 403application/json
1 fields
403application/jsonRequest is forbidden, API key is not valid
| Field | Type | Description |
|---|---|---|
message | string | Forbidden error messageExample Your API key is not valid, please refresh it. |
Other responses
204400404422