Generate Authentication Token

 

The first step always starts with authenticating your account. The authentication token is generated based on the data passed in. The endpoints that can be accessed will be regulated by the token via the scopes definition. For example, if a analytic scope is not passed in, it will not be possible to query data on the analytics endpoint. This will all be regulated by the server and any unauthorized access will return a 401. Check below for more information.

Required Parameters


client_id A unique identifier for your account. You may find it in your profile page. Just click your email address at the top navigation menu. It will show up on the right column.
client_secret The secret for your account. It will also show up in your profile page.
scope Specifies what endpoints are going to be granted access through the generated token. Example Values: "impressions", "user", "analytic", "app user"
username Username
password Password for the provided username
grant_type Grants you access depending on the information you pass. Can either be ' http://api.imrsv.com/grant_type/device_app/1.0 ' or 'REFRESH_TOKEN' check the documentation for refreshing the token access.

Request
POST /oauth/v2/device HTTP/1.1  
Content-Type: application/json{
  "client_id":"4_5o7gp9bcazk0okskscc08s8k4c8ggk88c4gkk40gw4ss4ck448",
  "client_secret":"1ow1kbc6fedcs0088ksc88c4c00s0s8gkkkccgoccc8wc0swks",
  "scope":"analytic",
  "username":"This email address is being protected from spambots. You need JavaScript enabled to view it.",
  "password":"password123",
  "grant_type":" http://api.imrsv.com/grant_type/device_app/1.0 "
}


Response
200{
  "access_token": "ACCESS_TOKEN",
  "expires_in": "NUMBER_OF_SECONDS",
  "token_type": "bearer",
  "scope": "analytic",
  "refresh_token": "REFRESH_TOKEN"
}



Response
400{
  "error": "invalid_client",
  "error_description": "Missing Client Information"
}


Refresh Access Token

 

After the access token expires, a new one should be generated to keep working with the API. We recommend using this endpoint to refresh your token, it's going to have a faster response.

Required Parameters


client_id A unique identifier for your account. You may find it in your profile page. Just click your email address at the top navigation menu. It will show up on the right column.
client_secret The secret for your account. It will also show up in your profile page.
scope Specifies what endpoints are going to be granted access through the generated token. Example Values: "impressions", "user", "analytic", "app user"
refresh_token The token for refresh
grant_type Grants you access depending on the information you pass. Can either be ' http://api.imrsv.com/grant_type/device_app/1.0 ' or 'REFRESH_TOKEN' check the documentation for refreshing the token access.

Request
GET /oauth/v2/device HTTP/1.1  
Content-Type: application/json{
  "client_id":"4_5o7gp9bcazk0okskscc08s8k4c8ggk88c4gkk40gw4ss4ck448",
  "client_secret":"1ow1kbc6fedcs0088ksc88c4c00s0s8gkkkccgoccc8wc0swks",
  "scope":"analytic",
  "refresh_token":"ZDdmN2U3MmY1OGQxMDA2NThkMjU4MWM3",
  "grant_type":" http://api.imrsv.com/grant_type/device_app/1.0 "
}


Response
200{
  "access_token": "ACCESS_TOKEN",
  "expires_in": 900,
  "token_type": "bearer",
  "scope": "analytic",
  "refresh_token": "REFRESH_TOKEN"
}



Response
400{
  "error": "invalid_grant",
  "error_description": "Invalid refresh token"
}



Response
400{
  "error": "invalid_client",
  "error_description": "Missing client information"
}



Response
400{
  "error": "invalid_client",
  "error_description": "The client id and client secret do not match"
}



Response
400{
  "error": "invalid_client",
  "error_description": "The client does not exist"
}



Response
400{
  "error": "invalid_scope",
  "error_description": "An unsupported scope was requested, please set the scope to 'impressions' 'user' or 'analytic' or a combination of those separated by spaces"
}



Response
400{
  "error": "invalid_request",
  "error_description": "The scope was not defined, please set the scope to 'impressions' 'user' or 'analytic' or a combination of those separated by spaces"
}



Response
400{
  "error": "invalid_request",
  "error_description": "If you are needing to refresh the access token, please use grant_type=refresh_token"
}


Get All Cameras

 

Return all the cameras for the account.

Required Parameters


access_token The token you received during authentication

Request
GET /api/v1.0/cameras HTTP/1.1  
Content-Type: application/json{
  "access_token":"NWYxNmRlYTBiYWM4NGRiYTg2MzgyOTQ4"
}


Response
200[
  {
    "bucket": "1",
    "camera_path": "",
    "description": "Ratione cupiditate doloremque magni voluptatem repellat.",
    "device_id": "1059742491",
    "display_name": "",
    "expires": "2013-12-18T13:42:57+01:00",
    "extra_description": "",
    "host": "",
    "key": "bd906b738cd0b9db416d038b34067e98",
    "label": "Et corrupti quae.",
    "status": "active",
    "tags": [
      "Presenter 469"
    ]
  },
  {
    "bucket": "2",
    "camera_path": "",
    "description": "Ad aut cumque qui iusto.",
    "device_id": "110092322",
    "display_name": "",
    "expires": "2013-11-28T20:59:48+01:00",
    "extra_description": "",
    "host": "",
    "key": "82e2fbf64ccc8e035fab887b424dd7e0",
    "label": "Omnis quam delectus.",
    "status": "active",
    "tags": [
      "Store Dollar 48"
    ]
  }
]



Response
400{
  "error": "invalid_token",
  "error_description": "Invalid token"
}


Get Single Camera

 

Get information about a single camera. The developer needs to provide a single camera"s key.

Required Parameters


access_token The token you received during authentication
key Camera key

Request
GET /api/v1.0/cameras/{key} HTTP/1.1  
Content-Type: application/json{
  "access_token":"NWYxNmRlYTBiYWM4NGRiYTg2MzgyOTQ4"
}


Response
200{
  "bucket": "1",
  "camera_path": "",
  "description": "Ratione cupiditate doloremque magni voluptatem repellat.",
  "device_id": "1059742491",
  "display_name": "",
  "expires": "2013-12-18T13:42:57+01:00",
  "extra_description": "",
  "host": "",
  "key": "bd906b738cd0b9db416d038b34067e98",
  "label": "Et corrupti quae.",
  "status": "active",
  "tags": [
      "Presenter 469"
  ]
}


Get Impression Averages

 

Retrieves impression's average based on a camera key and a date range (defined with the 'from' and 'to' parameters. Additional filters can be passed to the query, check the data section below for more information.

Required Parameters


access_token The token you received during authentication
from Select a date to begin the filtering (YYYY-MM-DDTHH:MM:SS-TT:TT)
to Select a date to end the filtering (YYYY-MM-DDTHH:MM:SS-TT:TT)
camera_key Camera key

Optional Parameters


gender Gender for the impressions. Example Values: "male", "female"
age Age for the impressions. Example Values: "child", "young_adult", "adult", "senior"

Request
GET /api/v1.0/analytics/averages HTTP/1.1  
Content-Type: application/json{
  "access_token":"NWYxNmRlYTBiYWM4NGRiYTg2MzgyOTQ4",
  "from":"2012-12-12T10:12:10-01:00",
  "to":"2012-12-12T10:12:10-01:00",
  "camera_key":"ddfb392bfe55bb3b8fe4333c8abe2957",
  "gender":"male",
  "age":"child"
}


Response
200{
  "avg_attention": "3.9535",
  "avg_duration": "12.2209",
  "avg_glances": "2.3372"
}



Response
400{
  "error": "invalid_token",
  "error_description": "Invalid token"
}


Get Impressions

 

Retrieves the impressions based on a camera key. Additional filters can be used for the query. Results are returned in pages of 200 items. By default it returns the first page with the last 200 records. Use the 'page' parameter to access other records.

Required Parameters


access_token The token you received during authentication
from Select a date to begin the filtering (YYYY-MM-DDTHH:MM:SS-TT:TT)
to Select a date to end the filtering (YYYY-MM-DDTHH:MM:SS-TT:TT)
camera_key Camera key

Optional Parameters


gender Gender for the impressions. Example Values: "male", "female"
age Age for the impressions. Example Values: "child", "young_adult", "adult", "senior"
page The number of the page starting with 1. Example Values: "1", "10", "143"

Request
GET /api/v1.0/analytics HTTP/1.1  
Content-Type: application/json{
  "access_token":"NWYxNmRlYTBiYWM4NGRiYTg2MzgyOTQ4",
  "from":"2012-12-12T10:12:10-01:00",
  "to":"2012-12-12T10:12:10-01:00",
  "camera_key":"ddfb392bfe55bb3b8fe4333c8abe2957",
  "gender":"male",
  "age":"child",
  "page":1
}


Response
200{
  [
    {
      "glances": 10,
      "attention": 10,
      "duration": 20,
      "watcher_id": 5000,
      "gender": 2,
      "age": 3,
      "start_time": "2012-12-12T10:10:10-01:00",
      "end_time": "2012-12-12T10:12:10-01:00",
      "bucket": 13
    },
    {
      "glances": 13,
      "attention": 10,
      "duration": 30,
      "watcher_id": 5000,
      "gender": 2,
      "age": 3,
      "start_time": "2012-12-12T10:10:10-01:00",
      "end_time": "2012-12-12T10:12:10-01:00",
      "bucket": 13
    }
  ]
}



Response
400{
  "error": "invalid_token",
  "error_description": "Invalid token"
}


Get Impressions Totals

 

Retrieves impression's totals based on a camera key and a date range (defined with the 'from' and 'to' parameters. Additional filters can be passed to the query, check the data section below for more information.

Required Parameters


access_token The token you received during authentication
from Select a date to begin the filtering (YYYY-MM-DDTHH:MM:SS-TT:TT)
to Select a date to end the filtering (YYYY-MM-DDTHH:MM:SS-TT:TT)
camera_key Camera key

Optional Parameters


gender Gender for the impressions. Example Values: "male", "female"
age Age for the impressions. Example Values: "child", "young_adult", "adult", "senior"

Request
GET /api/v1.0/analytics/totals HTTP/1.1  
Content-Type: application/json{
  "access_token":"NWYxNmRlYTBiYWM4NGRiYTg2MzgyOTQ4",
  "from":"2012-12-12T10:12:10-01:00",
  "to":"2012-12-12T10:12:10-01:00",
  "camera_key":"ddfb392bfe55bb3b8fe4333c8abe2957",
  "gender":"male",
  "age":"child"
}


Response
200{
  "total_impressions": 0,
  "total_attention": 0,
  "total_duration": 0,
  "total_glances": 0,
  "gender_male": 0,
  "gender_female": 0,
  "age_child": 0,
  "age_young_adult": 0,
  "age_adult": 0,
  "age_senior": 0
}



Response
400{
  "error": "invalid_token",
  "error_description": "Invalid token"
}


Get User Info

 

Get information about a single user.

Required Parameters


access_token The token you received during authentication

Request
GET /api/v1.0/users HTTP/1.1
Content-Type: application/json{
  "access_token":"NWYxNmRlYTBiYWM4NGRiYTg2MzgyOTQ4"
}
Request
POST /api/v1.0/users HTTP/1.1
Content-Type: application/json{
  "username": "This email address is being protected from spambots. You need JavaScript enabled to view it."
}


Response
200{
  "user": {
    "email": "This email address is being protected from spambots. You need JavaScript enabled to view it.",
    "first_name": "John",
    "last_name": "Smith",
    "status": "active",
    "username": "This email address is being protected from spambots. You need JavaScript enabled to view it."
  }
}



Response
400{
  "error": {
    "message": "Invalid username password combination",
    "type": "UserAuthenticationException"
  }
}


Set Host And Device For Camera

 

Update the host and device information for the camera.

Required Parameters


access_token The token you received during authentication
key Camera key
host Host
device_id Device identifier

Request
PUT /api/v1.0/cameras/{key} HTTP/1.1
Content-Type: application/json{
  "access_token":"NWYxNmRlYTBiYWM4NGRiYTg2MzgyOTQ4",
  "host":"Ironwood",
  "device_id":"Logitech HD920 #1"
}
Request
POST /api/v1.0/cameras/{key} HTTP/1.1
Content-Type: application/json{
  [
    {
      "host": "Ironwood",
      "device_id": "Logitech HD920 #1",
      "camera_path": "camera path",
      "display_name": "display name",
      "extra_description": "extra"
    }
  ]
}


Response
200{
  "message": "Host updated. ",
  "camera": {
    "key": "\u201cKEY\u201d",
    "host": "Ironwood",
    "device_id": "Logitech HD920 #1"
  }
}



Response
400{
  "message": "MESSAGE",
  "camera": {
    "key": "KEY"
  }
}