Message Services API Reference

  1. API key
  2. Authorization
  3. Rate Limits
  4. HTTP Headers
  5. API Root
  6. HTML
  7. PDF
  8. Image

API key

To use the Message Services API you will need to obtain an API key. To do so:

  1. Log into the BEE Plugin Developer Portal
  2. Locate the application that you wish to work with, and click on Details
  3. Locate the Message Services API section and click on Create New API Key
  4. Acknowledge the message that reminds you that if you exceeds the number of API calls included in your plan, you may be charged for overages and click on Create Key
  5. You’re done!

How to obtain API key for Message Services API

Authorization

Bee Message API uses API Keys to authenticate requests for resources.  You can manage your API Keys within the Developer Portal.  All requests must be made over HTTPS and contain the following HTTP Header:
Authorization: Bearer {token}

Rate Limits

API requests rate limits exist independently of API key’s monthly usage allowance.

By default, the Bee Message API has the following rate limits:

  • Per minute: 500 requests
  • Per second:  100 requests

HTTP Headers

  • X-Rate-Limit: An integer representing the total number of requests available per cycle. Exceeding the limit per cycle results in a 429 error.  (e.g. 500)
  • X-Rate-Limit-Remaining: An integer representing the number of remaining requests before the next cycle begins, and the count resets. (e.g. 100)
  • X-Rate-Limit-Reset: A Unix timestamp representing the time the next cycle will begin, and the count will reset.
  • Retry-After: A Unix timestamp representing the time the application may resume submitting requests.

API Root

All API access is over HTTPS, and accessed from the following URL:
https://api.getbee.io/{version}/message/{resource}

Versions

Version Released on
V1 4/25/2019
Beta 4/06/2019

Example

https://api.getbee.io/v1/message/html

Structure

api.getbee.io the api
/v1 the version of the api
/message the collection of services
/html the resource from the collection of services

Resources

HTML

POST /html

Content-Type: application/json

Request

Parameters

page object required A Bee Plugin template in JSON format

Example




{
  page: {
     body: { ... },
     template: { ... },
     rows: { ... },
     title: '',
     description: ''
 }
}


Response

application/html

The HTML message

Status Codes

200 OK
400 Bad Request
401 Unauthorized
429 Too many requests
500 Server error

PDF

POST /pdf

Content-Type: application/json

Request

Parameters

html string required A Bee Plugin HTML message
page_size string Accepted values:

  • Letter (default)
  • A4
  • A3
  • Full

Full: a single page using 900px as page width. The page_orientation is always portrait when using this page size.

page_orientation string Accepted values:

  • Landscape (default)
  • Portrait
file_type string Accepted values:

  • pdf



{"html":"a","file_type":"pdf","page_size":"Full","page_orientation":"portrait"}


Response

application/json

A JSON string that will contain the URL of the temporary location of the PDF document.

The file is available for 24 hours.




{"statusCode":200,"body":{"url":"https:\/\/pro-bee-beepro-pdf.s3.amazonaws.com\/public\/pdf\/87ElCDpHHk.pdf","filename":"87ElCDpHHk.pdf","page_size":"full","page_orientation":"portrait","content_type":"application\/pdf"}}


Status Codes

200 OK
400 Bad Request
401 Unauthorized
429 Too many requests
500 Server error

Image

POST /image

Content-Type: application/json

Request

Parameters

html string required A Bee Plugin HTML message
width integer required The image width in pixels
height integer The image height in pixels
default: applies a proportional value based on the given width, keeping the image aspect ratio
When the value is not proportional to the given width:

  • If it’s higher: the proportional value applies
  • If it’s lower: the image is cropped
file_type string required Accepted values:

  • jpg
  • png (coming soon)

Example




{
    "html": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\" /></head><body><div style='width:900px; margin: 30px;'>Hello World!</div></body></html>",
    "width": 215,
    "height": 125,
    "file_type": "jpg"
}


Response

application/jpg

The raw image data

Status Codes

200 OK
400 Bad Request
401 Unauthorized
429 Too many requests
500 Server error