Evercam.io API
Base URI
The evercam REST API supports multiple different authentication mechanisms to ensure that whatever environment you find yourself in, we’ve got you covered. This section of the documentation outlines the various methods available.
Basic
To make it as easy as possible for developers to quickly test and learn the various resource actions available we’ve enabled HTTP basic authentication using your username (or email) and password. The following cURL command illustrates this authentication method.
curl -X GET https://api.evercam.io/v1/... \
-u {username}
Session
As evercam utilises cookies to maintain a users session once they have been logged in, any ajax requests originating from the same user agent can be told to include the apprioriate credentials. This can be achieved in jQuery in the following way:
jQuery.ajax({
url: 'https://api.evercam.io/v1/...',
xhrFields: {
withCredentials: true
},
statusCode: {
200: {
...
},
...
},
...
});
OAuth 2.0
Implicit Grant
Our implementation supports the implicit grant type which can be used to obtain access tokens. It is optimised and secured for clients with a predetermined set of redirect uris. Typically this means a browser using javascript. It is a redirection-based flow which, when successfully authorized, results in the browser being directed back to the client application with an access token appended to the fragment portion of the redirect uri. The process starts with the client (you) redirecting the user (their browser) to our authorization endpoint with the following querystring parameters. Values surrounded with curly braces { } are required, those surrounded by square brackets [ ] are optional.
https://www.evercam.io/oauth2/authorize...
?response_type=token
&client_id={your evercam client id}
&scope={the access scopes you wish to use}
&redirect_uri=[one of your registered callback uris] // optional
&state=[a value you choose to help prevent CSRF] // optional
If the user has previously granted your application access to all the resources requested in the scope
parameters, or if the user chooses to now authorize those scopes,
evercam will generate a new access token and redirect the user back to the either the redirect_uri
parameter you provided or to the default callback uri associated with your client account when you registered.
The access token and its duration will be appended as part of the uri fragment as follows:
https://{redirect_uri}#access_token=410d79341e45c915&token_type=bearer&expires_in=3600
If the user declines your authorization request or if your request is malformed or invalid then the user will be redirected back to the {redirect_uri} (or default callback uri) with an error status and message as follows:
https://{redirect_uri}#error=access_denied&error_description=some+error+message&state={your state}
Should the client_id
parameter be invalid or the redirect_uri
parameter not match one of the values you have registered with your account then the user will
be shown an error on the evercam site.
Evercam.js
Evercam.js allows you to easily access all evercam.io APIs and also works as jQuery plugin which can easily show image from any evercam-enabled camera on a website. jQuery is dependency and it has to be included before evercam.js.
Including Evercam.js
Edit your HTML page and put following two lines inside head
tag
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src='http://cdn.evercam.io/js/v1/evercam.js'></script>
So it will look like this:
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src='http://cdn.evercam.io/js/v1/evercam.js'></script>
</head>
<body>
</body>
</html>
Showing camera snapshots
Via attributes
Simplest way to show image from camera on your website is to just add img tag with evercam specific attributes. Evercam.js will automatically load camera image into img tag with ‘evercam’ attribute set to stream name and refresh it every X seconds times 1000 (set in ‘refresh’ attribute). Typical camera image resolution is 640x480 pixels but you can adjust it to your needs using width and height parameters. Following line of code will get new snapshot from camera every 5 seconds and display it as 320x240 pixels image:
<img evercam='dublin-rememberance-floor2' width="320" height="240" refresh='5000' />
Following html page will display camera image on full screen and update it every 2 seconds:
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src='http://cdn.evercam.io/js/v1/evercam.js'></script>
</head>
<body>
<img evercam='dublin-rememberance-floor2' width="100%" height="100%" refresh='2000' />
</body>
</html>
Via JavaScript
Load camera image into jQuery selector by calling evercam method with ‘snapshot’ as first argument and options dictionary as second.
$(img).evercam('snapshot', {
name: name,
refresh: refreshRate
});
Following code will get new snapshot from camera every 5 seconds and display it as 320x240
pixels image:
$(img).evercam('snapshot', {
name: 'dublin-rememberance-floor2',
refresh: 5000
}).width(320).height(240);
{format}
{id}
/cameras.{format}
{format}
{id}
/rights.{format}
{id}
.{format}
{id}
.{format}
{id}
/credentials.{format}
{id}
.{format}
{id}
/cameras.{format}
Returns the set of cameras owned by a particular user
Path variables
Responses
{format}
Starts the new user signup process
Request parameters
Forename.
Lastname.
Username.
Country.
Email.
Password.
Responses
{id}
.{format}
Updates full or partial data on your existing user account
Path variables
Username.
Request parameters
Forename.
Lastname.
Username.
Country.
Email.
Responses
{id}
.{format}
Delete your account, any cameras you own and all stored media
Path variables
Responses
{format}
{id}
.{format}
{id}
.{format}
{format}
{id}
.{format}
{id}
/shares.{format}
{id}
/share.{format}
{id}
/share.{format}
{id}
.{format}
{id}
/snapshots.{format}
{id}
/snapshots.{format}
{id}
/snapshots/latest.{format}
{id}
/snapshots/range.{format}
{id}
/snapshots/{year}
/{month}
/days.{format}
{id}
/snapshots/{year}
/{month}
/{day}
/hours.{format}
{id}
/snapshots/{timestamp}
.{format}
{id}
/snapshots/{timestamp}
.{format}
{id}
/snapshots/{timestamp}
.{format}
{id}
/snapshot.jpg.{format}
{format}
Tests if given camera parameters are correct
Request parameters
External camera url.
Snapshot url.
Camera username.
Camera password.
Responses
{id}
.{format}
Returns all data for a given camera
Path variables
Responses
{id}
.{format}
Updates full or partial data for an existing camera
Path variables
Camera Id.
Request parameters
Camera name.
Is camera public?
External camera host.
Internal camera host.
External camera http port.
Internal camera http port.
External camera rtsp port.
Internal camera rtsp port.
Snapshot url.
Camera username.
Camera password.
Responses
{format}
Creates a new camera owned by the authenticating user
Request parameters
Camera Id.
Camera name.
Is camera public?
External camera host.
Internal camera host.
External camera http port.
Internal camera http port.
External camera rtsp port.
Internal camera rtsp port.
Snapshot url.
Camera username.
Camera password.
Responses
{id}
.{format}
Deletes a camera from Evercam along with any stored media
Path variables
Responses
{id}
/shares.{format}
Get the list of shares for a specified camera
Path variables
The unique identifier for a camera.
Responses
{id}
/share.{format}
Create a new camera share
Path variables
Request parameters
Email address of user to share the camera with.
A comma separate list of the rights to be granted with the share.
Not currently used.
Not currently used.
Not currently used.
Responses
{id}
/share.{format}
Delete an existing camera share
Path variables
The unique identifier for a camera.
Request parameters
The unique identifier of the share to be deleted.
Responses
{id}
.{format}
Update an existing camera share (COMING SOON)
Path variables
Responses
{id}
/snapshots/latest.{format}
Returns latest snapshot stored for this camera
Path variables
Camera Id.
Request parameters
Should it send image data?
Responses
{id}
/snapshots/range.{format}
Returns list of snapshots between two timestamps
Path variables
Camera Id.
Request parameters
From Unix timestamp.
To Unix timestamp.
Should it send image data?
Limit number of results, default 100 with no data, 10 with data
Page number
Responses
{id}
/snapshots/{year}
/{month}
/days.{format}
Returns list of specific days in a given month which contains any snapshots
Path variables
Camera Id.
Year, for example 2013
Month, for example 11
Responses
{id}
/snapshots/{year}
/{month}
/{day}
/hours.{format}
Returns list of specific hours in a given day which contains any snapshots
Path variables
Camera Id.
Year, for example 2013
Month, for example 11
Day, for example 17
Responses
{id}
/snapshots/{timestamp}
.{format}
Returns the snapshot stored for this camera closest to the given timestamp
Path variables
Camera Id.
Snapshot Unix timestamp.
Request parameters
Should it send image data?
Time range in seconds around specified timestamp
Responses
{id}
/snapshots/{timestamp}
.{format}
Stores the supplied snapshot image data for the given timestamp
Path variables
Camera Id.
Snapshot Unix timestamp.
Request parameters
Image file.
Optional text note for this snapshot
Responses
{format}
{vendor}
.{format}
{vendor}
/{model}
.{format}
{format}
Returns set of support supported camera vendors
Responses
{vendor}
.{format}
Returns set of known models for a supported camera vendor
Path variables
Responses
{vendor}
/{model}
.{format}
Returns data for a particular camera model
Path variables
Responses
{format}
{mac}
.{format}
{format}
Returns all known IP hardware vendors
Responses
{mac}
.{format}
Returns all known IP hardware vendors filtered by MAC prefix
Path variables
Responses
Unique Evercam identifier for the camera
Human readable or friendly name for the camera
Username of camera owner
Unique identifier for the camera vendor
Name of the camera model
Unix timestamp at creation
Unix timestamp at last update
Unix timestamp at last heartbeat poll
Unix timestamp of the last successful heartbeat of the camera
Name of the IANA/tz timezone where this camera is located
Whether or not this camera is currently online
Whether or not this camera is publically available
External host of the camera
Internal host of the camera
External http port of the camera
Internal http port of the camera
Internal rtsp port of the camera
External rtsp port of the camera
Snapshot url
Camera username
Camera password
The physical network MAC address of the camera
GPS lng and lat coordinates of the camera location
Unique Evercam username
Unix timestamp at creation
Unix timestamp at last update
Unix timestamp at account confirmation
Users forename
Users lastname
Unique Evercam username
Users email address
Two letter ISO country code
Unique identifier for the vendor
Name of the vendor
String array of MAC prefixes the vendor uses
Whether or not this vendor produces Evercam supported cameras
String array of models currently known for this vendor
Unique identifier for the vendor
Name of the model
String array of all models known to share the same defaults
Various default values used by this camera model
Unique identifier for a camera share.
Unique identifier of the shared camera.
Unique user id of the user the camera is shared with.
The email address of the user the camera is shared with.
Either ‘public’ or ‘private’ depending on the share kind.
A comma separated list of the rights available on the share.
Unique Evercam identifier for the camera
Note for snapshot
Snapshot timestamp
Name of the IANA/tz timezone where this camera is located
Image data