Getting Started

This page will help you get started with Raptor App API.

For detailed guides and tips check out our new Knowledge Hub:
Visit Knowledge Hub

❗️

API Change Notice:

The "Raptor App API" was renamed to "Raptor App Legacy API" and the endpoint was changed to https://app-legacy.raptormaps.com instead of https://app.raptormaps.com on April 4, 2023.

Note that https://api.raptormaps.com is the latest API as of June 2021. "Raptor App Legacy API" will continue to be deprecated.

Third-party data ingestion still remains at [https://app-legacy.raptormaps.com].

The quickest way to get started using the Raptor App API is by copying your API token from the web portal that can be found here: https://app.raptormaps.com/account

Please note that if you change your account's password your API token will change.

1462

Navigate to My Profile

1466

Copy your API token to your clipboard.

Once you have your API token, you may want to save it to your system's environment variables. We've chosen to save it as the environment variable, RAPTOR_MAPS_API_TOKEN.

Here is a short example using Python's requests library that shows how to retrieve a list of inspections for a particular solar farm.

import requests
import os

BASE_URL = "https://app.raptormaps.com"

# Authenticate with an API token
token = os.environ['RAPTOR_MAPS_API_TOKEN']

# GET all inspections for a particular solar farm
# Specify the solar farm uuid
solar_farm_uuid = '0006afb4-c616-4cb2-9ace-1658155d02d0'

# Specify API endpoint
endpoint = "%s/api/v2/solar_farms/%s/solar_inspections" % (BASE_URL, solar_farm_uuid)

# Specify request headers
headers = {
    'content-type': 'application/json',
    'Authentication-Token': token}

# Make HTTP GET request
r = requests.get(endpoint, headers=headers)

# Parse response
data = r.json()
inspections = data.get('solar_inspections')

print(inspections)
print('Request Complete!')

You can also retrieve your API token by logging in through the API as shown in the next example.

import getpass
import json
import requests

BASE_URL = "https://app.raptormaps.com"

def login(server_path, email, password):
    """Logs user in and Returns cookie and auth token
    Arguments:
        server_path (str): e.g. https://app.raptormaps.com
        email (str): e.g. [email protected]
        password (str): e.g. some_password
    Returns:
        {session: <hashed_session_string>}, <auth_token>
    """

    data = {"email":str(email),"password":str(password)}

    login_path = server_path + '/login'
    headers = {"Content-Type": "application/json"}

    r = requests.post(login_path, headers=headers, data=json.dumps(data))

    response = r.json()
    auth_token = response["response"]["user"]["authentication_token"]

    return auth_token

def main():

    """Authentication
    """

    # My email address for the Raptor App
    email = '[email protected]'

    # Get my password from command line input
    password = getpass.getpass()

    # Log me into the Raptor App
    token = login(BASE_URL, email, password)
    
    # Proceed to use the token in requests headers
    # Code goes here...

At this point you should be authenticated into the Raptor App. Enjoy.