API Methods

Overview

  • Using the Teleport APIs you can create, manage, view and broadcast Teleport feeds.
  • These are simple REST based apis that return JSON or XML, easily consumed from any website or app.
  • Get your APIKEY from the Dashboard -> Api section. It can be either the primary or secondary key.
  • Get your ACCESSKEY from the Feed Dashboard -> Share section. It gives view only access to the feed.

Access a live feed image

  • https://www.teleport.io/api/v1/frame-get/FEEDID?sizecode=SIZECODE&apikey=APIKEY&accesskey=ACCESSKEY
  • Returns actual jpg image data of the specified image size.
  • SIZECODE is one of [x480, x768, x1080] image sizes
  • The image size is guaranteed to be at most the specified size. It may be smaller if the feed does not have the specified size.
  • Guaranteed to return an image if one exists regardless of SIZECODE.
  • Http method: GET

Demo code

Access a recorded feed image

  • https://www.teleport.io/api/v1/frame-get/FEEDID?frametime=FRAMETIME&sizecode=SIZECODE&apikey=APIKEY&accesskey=ACCESSKEY
  • Returns the jpg image data of the specified image size, recorded at the requested time. If the time must be accurate to the second, otherwise a 404 error is returned.
  • FRAMETIME is in UTC format i.e. 2016-09-21T01:25:47Z
  • SIZECODE is one of [x480, x768, x1080] image sizes
  • The image size is guaranteed to be at most the specified size. It may be smaller if the feed does not have the specified size.
  • Guaranteed to return an image if one exists regardless of SIZECODE.
  • Http method: GET

Demo code

Get feed info

  • https://www.teleport.io/api/v1/feed-info?feedid=FEEDID&apikey=APIKEY&accesskey=ACCESSKEY
  • Returns feed properties, such as name, description, etc.
  • Http method: GET

Demo code

Query recorded frames

  • http://www.teleport.io/api/v1/frame-query/FEEDID?starttime=STARTTIME&endtime=ENDTIME&interval=INTERVAL&apikey=APIKEY&accesskey=ACCESSKEY
  • Returns an array of timestamps, for use in a frame-get or frame-delete method.
  • STARTTIME is in UTC format i.e. 2016-09-21T01:25:47Z
  • ENDTIME is in UTC format i.e. 2016-09-21T01:25:47Z
  • INTERVAL is how many seconds between each frame, use this to reduce the set of returned values. i.e. 3600 to return frames 1 hour apart.
  • Http method: GET

Demo code

Delete recorded frames

  • http://www.teleport.io/api/v1/frame-delete/FEEDID?frametime=FRAMETIME&apikey=APIKEY
  • Permanently deletes the specified frame.
  • Use the frame-query API to get frame timestamps.
  • FRAMETIME the exact frame timestamp to delete, it is in UTC format i.e. 2016-09-21T01:25:47Z
  • APIKEY is required to delete on all feeds. ACCESSKEY is ignored by this method.
  • Http method: DELETE

Demo code

Upload a frame to a feed

  • http://www.teleport.io/api/v1/frame-set/FEEDID?frametime=FRAMETIME&broadcastkey=BROADCASTKEY&apikey=APIKEY
  • Permanently deletes the selected frames.
  • FRAMETIME is time the frame was recorded, in UTC format i.e. 2016-09-21T01:25:47Z. If not present the current UTC time is used.
  • A broadcast key or an api key is required to upload frames.
  • The body of the request must contain the image data in binary representation. PNG or JPEG are supported.
  • The content must be less than 10MB.
  • Http method: POST

Demo code, upload from file

Demo code, upload from webcam (chrome, firefox, opera, android only)

Player embedding

  • The embed code is as follows:
    <iframe width="WIDTH" height="HEIGHT" src="http://www.teleport.io/feed-player/FEEDID?frametime=FRAMETIME&playmode=PLAYMODE&playmodespossible=PLAYMODESPOSSIBLE&framesizingmode=FRAMESIZINGMODE&showsplashbadge=SHOWSPLASHBADGE&showoverlaybadge=SHOWOVERLAYBADGE&overlayopacity=OVERLAYOPACITY&backgroundcolor=BACKGROUNDCOLOR&playframespeed=PLAYFRAMESPEED&playframeskipinterval=PLAYFRAMESKIPINTERVAL&playframecount=PLAYFRAMECOUNT&accesskey=ACCESSKEY" frameborder="0" allowfullscreen></iframe>
  • You can embed multiple players on a single page by using multiple iframe embed codes.
  • PLAYMODE is one of [liveimage, liveimageloop, livetimelapse, historyimage].
  • WIDTH,HEIGHT are pixel values. Use 100% for width to fill available horizontal space.
  • PLAYMODESPOSSIBLE is a comma separated list of the above.
  • FRAMESIZINGMODE one of [auto, uniformtofill, uniform].
  • FRAMETIME is the timestamp must refer to an existing frame, it the frame does not exist the most recent or live frame will be shown. Format must be 2014-01-14T21:07:17Z, this is the UTC 8601 format. Get this value from the player share section, while viewing the frame of interest.
  • PLAYFRAMESPEED controls how fast frames change in live loop and history image play modes. Value one of [30fps, 10fps, 0.5sec, 1sec, 3sec, 10sec]. Custom value not accepted at this time. Contact us if this is a requirement. 30fps and 10fps play speeds will only begin once all the frames are cached on the client, hence the initial slow playback.
  • PLAYFRAMESKIPINTERVAL controls the time interval between each played frame in live loop and history image play modes. Value one of [sec, min, 5min, 15min, hour, day, month]. Custom value not accepted at this time. Email us if this is a requirement.
  • PLAYFRAMECOUNT controls how many frames to play. Applies to live loop play mode only at this time. Value between 1 and 1000.
  • APIKEY embed the player with an api key, giving it access to all feeds on the given account, including non-public feeds. WARNING: do not use this on public websites!
  • ACCESSKEY embed the player with a share key, giving it access to the feeds using this share key, including non-public feeds.
  • More coming soon. Please contact us via email for help!

Example of an embedded feed player with custom options, uniform sizing and live loop as default play mode

Demo code

Teleport data export

  • A PowerShell script is provided to allow for integration scenarios and export of recorded data from Teleport.
  • The script uses the public APIs above, so you can easily modify it.
  • Download the Teleport PowerShell export script

How to use the Teleport PowerShell export script:

  • The script isn't signed so you may get warnings from Windows as you should only download and run scripts you know about. Right click on the downloaded file, goto Properties and Unblock it.
  • To run the script, get into PowerShell, one way is to hit Windows + R and type powershell and click 'OK'.
  • On prompt type $PSVersionTable.PSVersion to get the Powershell version, if Major isn't 4 or greater install Powershell 4 from here.
  • Next enable execution policy on your computer, to do this you must run PowerShell as Administrator. Right click on the PowerShell icon in the task bar and click Run as administrator. Type Set-ExecutionPolicy Unrestricted. Once you're done exporting type Set-ExecutionPolicty Restricted to bring it back for best practice.
  • Now in the PowerShell window go to the folder where the script is downloaded using cd C:\Users\UserName\Downloads command.
  • And finally type .\teleport-export.ps1 to run the script. Here you will be asked to enter all parameters and begin the export. For each command type !? to get help.
  • To run directly from command you use : .\teleport-export.ps1 -feedId 'feedid' -startTime 20140601T000000 -endTime 20140901T000000 -interval 20000 -sizeCodes ('x480', 'x768', 'x1080') -key 'apikey or accesskey' -exportFolder 'C:\TeleportExport\'
  • To load the script into Powershell, run . .\teleport-export.ps1 (note the extra . and space before the main command)
  • Once you do this, type Teleport-Export to run the export function directly, or get-help Teleport-Export -detailed to get help.

Using Powershell to broadcast live and historical images