Resource Manager


Overview

The Resource Manager API allows data providers the ability to upload multimedia files to the Intelligent Safety Platform and generate a public URL. These uploaded files are used with the RapidSOS Emergency Data APIs for data provisioning.

Data provisioning is a necessary step to ensure that media files are accessible via the RapidSOS CDN, which is already whitelisted through municipal firewalls, across the Intelligent Safety Platform coverage footprint.

After file upload, the generated URL should be used in any/all other Safety Platform input APIs to reference the uploaded resource. The sample code shown in this document is a useful reference, but in general the flow is as follows:

  1. Get an authentication token
  2. Create an upload/download URL
  3. Upload the resource to the upload URL
  4. Use the download URL in subsequent data provisioning

Audience

This document is intended for developers that are familiar with RESTful APIs, authentication processes (tokens), and API integration. Knowledge of JSON and python programming language can be helpful when reviewing this material.

Note: If you are uploading video for video verification use cases, you may want to follow the requirements defined here. Speak to your RapidSOS contact for clarification.

Making a Request

Step 1: Authentication

  • The service is authenticated via short-lived OAuth 2.0 access tokens that are valid for 1 hour. API spec found here POST /oauth/token
  • You must use the “client credentials” grant type for obtaining an access token. These are described as follows:
    • Client Credentials Grant Type: Used to authenticate your application’s access to the Multimedia Hosting API.

Step 2: File Upload Endpoint

The main feature of this API is the ability to upload certain file types to RapidSOS managed cloud storage.

Limitations and Best Practices

While there are no restrictions on the file types or file sizes for this service - files will be opened by default in a new tab on a browser at PSAPs.

As general guidance it is recommended that file types be:

  • PDFs
  • standard media containers like MP3, MP4, AVI with codecs supported in browsers by default for playback
  • text files
  • images like PNGs or JPEGs, etc
  • It is also strongly recommended to keep file sizes below 10MB.

Please plan to confirm with RapidSOS implementation support for any special use-cases.

Formatting an upload request

This endpoint only accepts POST requests. POST Request to upload a file

  • When formatting the POST request for the Multimedia Hosting API, you should have already received your bearer token to authenticate your request.
  • The URL returned by this request is a temporary URL generated by AWS for the purpose of accessing/downloading the uploaded file.
    • This URL should be passed through to our Emergency Workflow API so it can be leveraged by RapidSOS Portal and any Partner integrations.
Persistent Uploads: Managing Files

Resolving ref://
When using the persistent_reference mode the URI returned must be resolved to an https:// URL. The reason for this is to support the download of uploaded media via RapidSOS support APIs. GET Resolve resource unique ID into download URL

  1. To receive a “resolved” ref:// just replace {} with the reference URI, something like:
  1. This will output if successful:
    https://api-sandbox.rapidsos.com/v1/resources/XXXX

Sample Code

NOTE: this example requires the requests python library