Click or drag to resize
ParaPlan Logo

How To Request Trips

This document will show how to request a trip and cancel a trip on the behalf of a client. Trip requests can be see in RequestedTrips or TripsInWrapper

Submit trip request

  • POST a array of TripRequest to AddTripRequest

    In the TripRequest, the following fields are mandatory:

    Tip Tip

    Populate fleetmanagerID with a valid FleetManagerID to auto-approve the request and assign the trip to that route.

    Trip Request
     1var postUrl = $"restURL/TripService/AddTripRequest?Token={token}&Device={device}";
     2
     3var http = (HttpWebRequest)WebRequest.Create(new Uri(postUrl));
     4http.Accept = "application/json";
     5http.ContentType = "application/json";
     6http.Method = "POST";
     7
     8string parsedContent = @"[{    
     9    "importTripID" : "guid1",
    10    "paraPlanClientID" : "311",
    11    "tripSource" : "ParaPlan Passenger Portal",
    12    "tripStatus" : "Requested",
    13    "tripProgram" : "Self Pay",
    14    "apptTime" : "1520539860",
    15    "dropOffTime" : "1520539860",
    16    "pickUpAddress" : "311 N Main St",
    17    "pickUpAddress2" : "Apt 1165",
    18    "pickUpCity" : "Greenville",
    19    "pickUpState" : "SC",
    20    "pickUpZipCode" : "29601",
    21    "dropOffAddress" : "1312 E. North St",
    22    "dropOffCity" : "Greenville",
    23    "dropOffState" : "SC",
    24    "dropOffZipCode" : "29607",
    25    "tripURL" : "https://ppp.paraplansoftware.com/trip/guid1/"
    26    },
    27    {    
    28    "importTripID" : "guid2",
    29    "paraPlanClientID" : "311",
    30    "tripSource" : "ParaPlan Passenger Portal",
    31    "tripStatus" : "Requested",
    32    "tripProgram" : "Self Pay",
    33    "apptTime" : "1520539860",
    34    "dropOffTime" : "1520539860",
    35    "pickUpAddress" : "1312 E. North St",
    36    "pickUpCity" : "Greenville",
    37    "pickUpState" : "SC",
    38    "pickUpZipCode" : "29607",
    39    "dropOffAddress" : "311 N Main St",
    40    "dropOffAddress2" : "Apt 1165",
    41    "dropOffCity" : "Greenville",
    42    "dropOffState" : "SC",
    43    "dropOffZipCode" : "29601",
    44    "tripURL" : "https://ppp.paraplansoftware.com/trip/guid1/"
    45    }]";
    46ASCIIEncoding encoding = new ASCIIEncoding();
    47Byte[] bytes = encoding.GetBytes(parsedContent);
    48
    49Stream newStream = http.GetRequestStream();
    50newStream.Write(bytes, 0, bytes.Length);
    51newStream.Close();
    52
    53var response = http.GetResponse();
    54
    55var stream = response.GetResponseStream();
    56var sr = new StreamReader(stream);
    57var s = sr.ReadToEnd();
    58var response = JsonConvert.DeserializeObject<AddTripRequestResponse>(s);
  • It will return a AddTripRequestResponse which will contain a list of trips that were successfully requested and a list of trips that were not submited and the failure reason for each.

    success json
    {
        "errorMessage": "",
        "success": true,
        "tokenExists": true,
        "tokenIsValid": true,
        "AddedTrips": [
            "guid1",
            "guid2"
        ],
        "FailedTrips": []
    }
    failure json
    {
        "errorMessage": "Not all trips added. Inspect FailedTrips",
        "success": false,
        "tokenExists": true,
        "tokenIsValid": true,
        "AddedTrips": [],
        "FailedTrips": [
            {
                "Key": "guid1",
                "Value": "ImportClientID must be populated\r\nParameter name: ImportClientID"
            },
            {
                "Key": "guid2",
                "Value": "ImportClientID must be populated\r\nParameter name: ImportClientID"
            }
        ]
    }

Cancel Trip

  • Make a GET request with ActionID of 2 and the cancelation reason as the Value to AddAction

    Important note Important

    Only Trips with a valid TripID can be cancelled. TripRequests that are not yet agency-approved cannot be cancelled.

    Trip Request
    1var addActionUrl = $"{storedrestURL}TripService/Trips/AddAction2/{tripId}/2?Token={token}&Device={device}&UserID={userId}&Timestamp={timestamp}&Value=CancelReson&lat={lat}&lng={lng}";
    2using (WebClient client = new WebClient())
    3{
    4    string s = client.DownloadString(addACtionUrl);
    5    var simpleResponse = JsonConvert.DeserializeObject<SimpleResponse>(s);
    6
    7}
  • It will return a SimpleResponse indicating if the call succeeded or not.

    SimpleResponse Result
    {
      "errorMessage": "",
      "success": true,
      "tokenExists": true,
      "tokenIsValid": true
    }