Click or drag to resize
ParaPlan Logo

How To Login

This document will highlight how to obtain a key to connect to the ParaPlan API.

Request a key by passing in the user's email address, their password encoded in SHA-512 and the calling device name or brower agent. This will give you back a token and a restURL.

Caution note Caution

The restURL may change, so be sure not to hard code it.

Sign future requests with the key and the same device name. This token is good for 12 hours. All results have a tokenExists and tokenIsValid bool property that can be queried for token status. You can also refresh a token with out making the user login.

Postman is good for API testing (https://www.getpostman.com)

Usage
Note Note

When authenticating with username and password, the API will return token to sign calls AND a restURL. Use the restURL to prefix future calls.

How to get a key:

  1. Send a GET request to:Login(String, String, String, String, String, String)

    Login
    1var loginUrl = $"https://aws.engraph.com/ParaPlanREST/UserService/Login?UserName={email}&Password={password}&Device=p3&Version=0.1&DeviceToken=none&UTCOffset=-4";
    2using (WebClient client = new WebClient())
    3{
    4    string s = client.DownloadString(loginUrl);
    5    var token = JsonConvert.DeserializeObject<UserToken>(s);
    6
    7}
  2. It will return back an object (UserToken) with information about your login that will look like:

    json
    {
      "AssignedRoute": null,
      "AssignedTimes": null,
      "AssignedTripCount": "0 Trips",
      "AssignedVehicle": null,
      "CanCallClients": true,
      "CanCancel": true,
      "CanScheduleTrips": true,
      "CanViewVehicles": false,
      "ClientCanRequestTrips": false,
      "ClientID": 0,
      "CollectGPS": false,
      "DatabaseID": 8889,
      "DefaultPaymentType": "Cash",
      "DeviceToken": null,
      "Key": "9d58088d-f4d0-4628-8b72-f082943476e1",
      "LocalDriverID": 33,
      "Name": "Users Name",
      "PPPAccess" : 1,
      "ProviderCanRequestTrips": false,
      "ProviderCanViewClientDetails": false,
      "ProviderPrograms": "",
      "ProviderProgramsList": null,
      "RESTUrl": "https://aws.engraph.com/REST/URSR/",
      "UserId": 34,
      "UserType": 0
    }
    Note Note

    PPPAccess determines if a user can have access to the ParaPlan Passenger Portal.

    Possible values are:
    0 = Not Registered
    1 = Is registered and has access
    2 = User is blocked from Portal
    3 = User has failed validation and needs dispatcher intervention

How to refresh a token

  • If an API call returns tokenIsValid == false and tokenExists == true, then you can refresh the token.

    Send a GET request to:RefreshToken(String, String, String, String)

    Refresh
    1var refreshUrl = $"{storedRESTUrl}/UserService/RefreshToken?Token={expiredToken}&UserName={email}&Password={SHA-512_encoded_password}&Device={App_Name}";
    2using (WebClient client = new WebClient())
    3{
    4    string newToken = client.DownloadString(refreshUrl);
    5
    6}
Tip Tip

The JSON needs to have the key in double quotes. So "apptTime" : value, "clientFirstName" : "Jon Smith",...

Tip Tip

Numbers do not need to be encased in quotes, but bools do. So "clientInWC" : "false" ... (https://jsonlint.com is good for json validation)

Tip Tip

nil is not an accepted value. Use null instead.