/convertToBase64

This endpoint is used to convert a file from a specified URL to a base64 encoded string.

Request Method

GET

Query Parameters

  • url: (required) The URL of the file to be converted to base64. This should be a fully qualified URL pointing to the desired file.

Request URL

https://node.nodetrigger.com/convertToBase64

Successful Response

A successful response will return the base64 encoded string of the file.

Error Responses

  • 400 Bad Request: Returned if the url query parameter is not provided.
  • 500 Internal Server Error: Returned if there is an error in fetching or converting the file.

How to Make a Call

To use this endpoint, make a GET request to the provided URL with the url query parameter specifying the file URL you want to convert.

Example 1

Convert an image file to base64.

Request:

GET https://node.nodetrigger.com/convertToBase64?url=https://example.com/image.png

Response:

{
  "base64": "iVBORw0KGgoAAAANSUhEUgAA..."
}

Example 2

Convert a PDF file to base64.

Request:

GET https://node.nodetrigger.com/convertToBase64?url=https://example.com/document.pdf

Response:

{
  "base64": "JVBERi0xLjQKJ..."
}