Skip to main content

Integrated RapidSOS Portal (iRP) API1.0.0

THIS API WILL BE DEPRECATED JUNE, 2021. Please refer to the updated version of Integrated RapidSOS Portal - iRP v.2 API 

This API is used for integrating the RapidSOS Portal into partner solutions.

THIS API WILL BE DEPRECATED JUNE, 2021.

Please refer to the updated version of Integrated RapidSOS Portal - iRP v.2 API 

 

Overview

RapidSOS offers this API endpoint for partners interested in adding RapidSOS Portal directly into their pre-existing solution.

Using any login for RapidSOS Portal, a token can be retrieved which can be used in the RapidSOS Portal URL to authenticate. This allows a seamless automatic display of rich data as rendered by the Portal.

 

Rapidsos Portal 

The following URL is used to authenticate to the RapidSOS Portal:

Portal URL

https://api-sandbox.rapidsos.com/v1/scorpius/user/api-token-auth

 

A user object is required to enter this endpoint. The user object stores information about the logged-in user, returned by the identity provider. It is generated when a user authenticates and before rules run.This token (user object) is the equivalent of a RapidSOS Portal login.

This can be created through the admin panel using the add user feature:

  1. Enter the email address and Password > Press Login
  2. Select > Admin
  3. Select > Users tab
  4. Select > Add User
  5. Fill out the required information (first name, last name, email, role) and press > SAVE

Add User

 

 

API Utilization

Both users and administrators can generate auth tokens for this feature.

Here is some important information when working with this endpoint:

  • POST Requests

The endpoint accepts POST requests in application/json format. The header should be Content-Type: application/json.

  • Body of a Request

The body of the request should consist of the email address and password of the Rapidsos Portal account that is being leveraged in the integration.

  • Response of a Request

The response of the request will be a refresh_token and a token. The token portion will be used in the url.

 

Query URL Creation

Once the integrated solution completes the API request, it should take the token contained within the response, and along with the phone number, create the query URL as shown below.

https://rapidsosportal.com/query-interface?caller_id=15555555555&access…{TOKEN}

Where {TOKEN} refers to the token from the response of the token API.

With the token, that URL will open an instance of RapidSOS Portal in the browser in which it is entered.

Integrated solutions can use this link in an embedded web widget, but are recommended to use an OS system call to pop open the system’s default web browser for display (details of usage are up to the maintainers of each integrated solution).

IMPORTANT: The login session enabled by this token will be valid for 1 hour.

 

Implementation Flow

The following diagram depicts an integration flow when implementing a web browser/widget.

 

Code Sample

Script to receive an access token from /api-token-auth:

import requests
import argparse
import getpass
import json
def get_login_token(creds):
        url = 'https://api-sandbox.rapidsos.com/v1/scorpius/user/api-token-auth'
        email = creds.email
        password = creds.password
        payload_dict = {
                'email': f"{email}",
                'password': f"{password}"
        }
        payload = json.dumps(payload_dict)
        headers = {
                'Content-Type':"application/json"
        }
        response = requests.request("POST", url, data=payload, headers=headers)
        print("This is your token:","\n",(json.loads(response.text)['token'])
if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description="""Generate a user token for Rapidsos Portal.
        Press CTRL+C to terminate early.
        """
    )
    parser.add_argument(
        '-e',
        '--email',
        required=True,
        help='Email associated with the Rapidsos Portal account'
    )
    parser.add_argument(
        '-p',
        '--password',
        required=True,
        help='Password associated with the Rapidsos Portal account'
    )
    args = parser.parse_args()
    get_login_token(args)

 

 

Additional Reference

 

 

 

About us

We build APIs that share data with first responders to help protect lives.

RapidSOS logo

Contact