1. Home
  2. Limnu API
  3. Function: boardImageFileUpload

Function: boardImageFileUpload

Overview

boardImageURLUpload allows for direct upload of images files (as opposed to boardImageURLUpload) to a board. The image is placed at the “origin”; that is, the location on the board where a user is placed the first time they visit the board. Like all Limnu assets, anyone can move or resize the image once it is on the board.

Limnu currently supports JPEG, PNG, and GIF formats. (GIFs containing animations will only show a single frame on a Limnu board.) If you would like Limnu to support other formats, please contact support@drawlala.com.

Parameters

Input parameters:

  1. apiKey: string - the private API key issued by Limnu to developers.
  2. boardId: string - the boardId of the board you wish to upload into, as issued by boardCreate.
  3. contentType: string - the content type of the image. (Also called media type or Mime type.)
  4. data_base64: string - the image data itself, encoded in base64 format.

Call attribute details: contentType

This parameter should contain the content type string that matches the file you are uploading. If your contentType parameter does not match the actual file, this call will fail.

Call attribute details: data_base64

Your binary image must be converted to the JSON-friendly “Base 64” format. To convert your image, you can use:

The end result will be a file approximately 33% larger than your original image. This entire file should be put into the value for the data_base64 key in the API call. This means that your API call will be large, and depending on the speed of your connection to the net, it may take some time to complete.

As a result, if your image passes the requirements of boardImageURLUpload, it’s going to be faster and easier to use that call instead.

Response attribute details: fileId

fileId is the permanent, unique identifier for the new image.

Example data

Example of correct JSON input:

{

"apiKey": "K_isR4E6qcQamY0NxFuKa9aw7k5hssRBQXuqpStgR1qU1A",

"boardId": "B_B7LyhbF2QGaCV4",

"contentType": "image/png",

"data_base64": "iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAIAAABuYg/PAAAACXBIWXMAAAs..."

}

Example of JSON output from a successful call:

{

"success": true,

"fileId": "I_X7LD9O4CTGFHN2fbDUsG"

}

Example of JSON output from a failed call:

{

"success": false,

"reason": "No such board: B_B7LyhbF2QGaCV4"

}

Command Line Testing

Here’s an example of how to test boardImageFileUpload from the command line:

curl \

https://api.drawlala.com/v1/boardImageFileUpload \

--request POST \

--header "Content-Type: application/json" \

--data @boardImageFileUpload.json

The contents of the file named boardImageFileUpload.json are:

{

"apiKey": "K_isR4E6qcQamY0NxFuKa9aw7k5hssRBQXuqpStgR1qU1A",

"boardId": "B_B7LyhbF2QGaCV4",

"imageURL": "http://www.brycecanyon.org/wp-content/uploads/2016/01/main-01d.jpg"

}