Comment on page
Authorizing Requests
In most cases, when sending requests to the DaaS services, the request includes a header that contains an authorization code. The authorization code is acquired by sending a request to DAE’s DaaS token service.
URL | HTTP Verb | Functionality |
/authorize | POST | Login with posting credentials to get access and refresh JSON Web Tokens |
post
https://api.disasteraware.com/
authorize
Get accessToken and refreshToken
cURL
Java
Node.js
PHP
Python
curl --location --request POST \
'https://api.disasteraware.com/authorize' \
--header 'Content-Type: application/json' \
--data-raw '{
"username":"your_username",
"password":"your_password"
}'
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.disasteraware.com/authorize");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Content-Type", "application/json");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("{ \"username\":\"your_username\", \"password\":\"your_password\" }");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
var fetch = require('node-fetch');
fetch('https://api.disasteraware.com/authorize', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ "username":"your_username", "password":"your_password" })
});
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/json'
);
$data = '{ "username":"your_username", "password":"your_password" }';
$response = Requests::post('https://api.disasteraware.com/authorize', $headers, $data);
import requests
headers = {
'Content-Type': 'application/json',
}
data = '{ "username":"your_username", "password":"your_password" }'
response = requests.post('https://api.disasteraware.com/authorize', headers=headers, data=data)
Please use the provided credentials to complete this request. The response will include a JSON Web Token (JWT) that you will send with the Authorization request header in the following format:
{
"Authorization": "Bearer <insert-json-web-token>"
}
Last modified 2yr ago