API

Obtain detail programmatically with our application programming interface

Obtaining an API Key for Mobile Eye

  • 7SIGNAL utilizes OAuth 2.0, the industry-standard protocol for authorization. Obtain an API key and secret through Mobile Eye by navigating to the Users icon along the left navigation bar, then clicking Manage Users.
  • Then click the API Key icon along the left, and the Add API Key button at the top.
  • Select either Administrator or User and click Save.  Users will not be able to make API calls to Configuration endpoints, once 7SIGNAL makes them available.
  • Copy and paste and save your API key and secret. You will use it in the token exchange request/response process to connect to the API.

Public Links to Online Documentation

https://api-v2.7signal.com/swagger-ui/index.html#/

Sample Code (Python)

This program will authenticate, then get a list of Mobile Eye incidents detected for the last 24 hours.

import requests
import json 

"""
First step in using 7SIGNAL API is to exchange your key and secret for a JWT token.
This is accomplished with an OAuth request
"""
auth_data = {
  "client_id": "62CAF473.your_key_here.XMXQS",
  "client_secret": "fKKPuynq.your_secret_here.FlFjZupS",
    "grant_type": "client_credentials", "scope": 
    "openid https://login.7signal.com/scopes/user.read https://login.7signal.com/scopes/user.admin"
}

auth_headers = {"Accept": "application/json"}
token_exch_response = requests.post('https://api-v1.7signal.com/oauth2/token', data = auth_data, headers = auth_headers)
token_exch_json_response = token_exch_response.json()

# This token can now be used for subsequent requests. Note the token will expire.
token = token_exch_json_response["access_token"]


"""
Once a token is acquired, it can be used to make calls to the API.
This is done using an Authorization header with a Bearer token.
"""
headers_incidents = {
    "Accept": "application/json", 
    "Authorization": f"Bearer {token}"
}
incidents_response = requests.get('https://api-v1.7signal.com/incidents/agents', headers = headers_incidents)
incidents_json = incidents_response.json()


# Pretty print the JSON response to the console
incidents_json_formatted = json.dumps(incidents_json, indent = 2)
print()
print(incidents_json_formatted)