SingleTrip

The Client can POST, GET or PATCH a single trip to MediRoutes via the API. A single trip is comprised of a pickup and a dropoff event. Trip ID is a user-defined value. Trip GUID is a MediRoutes-defined value and will be returned along with the entire trip object upon successful trip insertion, or POST.

Please Note: Round trips need to be entered as two separate trips.

PATCH SingleTrip with Properties Endpoint

Instead of posting an entire trip model like the other PATCH endpoint does, you can submit changes to individual properties in the trip.

Request

POST{root_url}/v{version}/singletrip/withProperties
ParameterTypeDescriptionNotes
tripstringProperty_to_change model. See model definition belowREQUIRED
versionintAPI version; currently = "1"REQUIRED
Authorizationstringbearer {access token}REQUIRED

Model Definition

ParameterTypeDescriptionNotes
keystringThe property to changeREQUIRED
valuestringThe new value for the propertyREQUIRED

The model is a key/value pair of strings. If changes are made to numeric values or date/time values, they must be submitted as a string value as well otherwise it will not parse.

The allowed properties (Keys) that can be changed are:

KeyDescriptionExample
pickup.event_nameThe name of the pickup eventDoe, Jane - Pickup Appointment
pickup.complete_addressThe complete pickup address on a single line2882 N Scottsdale Rd, Scottsdale, AZ, 85257
pickup.event_location.location_nameThe location name for the pickup eventHonor Health Scottsdale
pickup.event_location.address1Pickup first address line2822 N Scottsdale Rd
pickup.event_location.address2Pickup second address line
pickup.event_location.cityPickup cityScottsdale
pickup.event_location.statePickup stateAZ
pickup.event_location.zipPickup zip85257
pickup.event_location.latitudePickup latitude33.4799636
pickup.event_location.longitudePickup longitude-111.9287566
pickup.appt_timePickup appointment time
pickup.pickup_timePickup pickup time2022-04-10 14:48:49.403
pickup.phone_numberPickup phone number5202342342
dropoff.event_nameThe name of the dropoff eventDoe, Jane - Dropoff Appointment
dropoff.complete_addressThe complete dropoff address on a single line6606 W Camelback Rd Unit 123, Glendale, AZ, 85301
dropoff.event_location.location_nameThe location name for the dropoff eventXYZ Retirement Community
dropoff.event_location.address1Dropoff first address line6606 W Camelback Rd
dropoff.event_location.address2Dropoff second address lineUnit 123
dropoff.event_location.cityDropoff cityGlendale
dropoff.event_location.stateDropoff stateAZ
dropoff.event_location.zipDropoff zip85301
dropoff.event_location.latitudeDropoff latitude33.5097911
dropoff.event_location.longitudeDropoff longitude-112.2035528
dropoff.appt_timeDropoff appointment time04/10/2022 3:00PM
dropoff.pickup_timeDropoff pickup time
dropoff.phone_numberDropoff phone number5022342342
space_typeThe space type required for the tripAMB
billable_distanceThe billable distance for the trip4
trip_typeThe trip type in an integer value between 1 and 3. 1 = Will Call Trip, 2 = Appointment Trip, 3 = Return Trip2
callerThe caller for the tripJohn Doe
additional_passengersThe additional passengers for the tripAMB|1

NOTE: Changes to Address fields in either the Pickup event or Dropoff event other than changes to the Latitude or Longitude will cause the address to get geocoded with the new changes and return the correct address in the payload.

Here is an example of how the submission payload should look for a single change to one of the properties:

{
 "trip_guid": "0c7e24aa-7ebf-457c-9e87-b8ec87fef40c",
 "tp_api_key": "56e1015d588fgdpf448384b6b3a345dfgd564",
 "properties_to_change": [{"Key": "pickup_zip", "Value": "85051"}]
}

Here is another example where multiple properties require changes:

{
 "trip_guid": "0c7e24aa-7ebf-457c-9e87-b8ec87fef40c",
 "tp_api_key": "56e1015d588fgdpf448384b6b3a345dfgd564",
 "properties_to_change": [
             {"Key": "pickup_zip", "Value": "85051"},
             {"Key": "pickup_phone_number", "Value": "6025551212"},
             {"Key": "dropoff_phone_number", "Value": "6025551313"}]
}

Additional passengers is the only property that is slightly different from the rest. It requires pipe delimited value that contains the space type and the count. It can also contain multiple passengers with different space types. If there is more than one space type required for additional passengers, then you will need to put a semicolon between each additional passenger value.

For example: If the trip requires one additional ambulatory passenger, the value would be “AMB|1”

{
 "trip_guid": "0c7e24aa-7ebf-457c-9e87-b8ec87fef40c",
 "tp_api_key": "56e1015d588fgdpf448384b6b3a345dfgd564",
 "properties_to_change": [{"Key": "additional_passengers", "Value": "AMB|1"}]
}

If the trip requires two additional passengers, one ambulatory and one wheelchair the value would be “AMB|1;WCH1”

{
 "trip_guid": "0c7e24aa-7ebf-457c-9e87-b8ec87fef40c",
 "tp_api_key": "56e1015d588fgdpf448384b6b3a345dfgd564",
 "properties_to_change": [{"Key": "additional_passengers", "Value": "AMB|1;WCH|1"}]
}

Expected Response Codes

CodeDescription
200Request was successful; API Key(s) and Funding Source(s) returned.
400Missing or unaligned data. Error message will be returned with response
403The API key used does not have access to this resource.
500Unknown error; Contact MediRoutes.

POST SingleTrip Endpoint

There are three types of trips that can be inserted into MediRoutes, each with slightly different required fields:

  1. Appointment Trips
  2. Return Trips
  3. Will Call Trips

Please Note: You can either pass in a complete address in one field (shown in the pickup address below) or a broken out address with each field separated for Address1, Address2, City, State, and ZIP (shown in the dropoff address below) . Latitude and longitude are required with either type of address.

Request

POST{root_url}/v{version}/singletrip
ParameterTypeDescriptionNotes
tp_api_keystringREQUIRED
trip_idstringREQUIRED
rider_idstringREQUIRED
pickup-
.event_namestring
.event_commentstring
.complete_addressstring
.event_location-
..location_namestring
..address1string
..address2string
..citystring
..statestring
..zipstring
..latitudedoubleREQUIRED
..longitudedoubleREQUIRED
.appt_timedatetimeformat = "2020-06-11 14:48:49.403"
.pickup_timedatetimeformat = "2020-06-11 14:48:49.403"
.phone_numberstring
dropoff-
.event_namestring
.event_commentstring
.complete_addressstring
.event_location-
..location_namestring
..address1string
..address2string
..citystring
..statestring
..zipstring
..latitudedoubleREQUIRED
..longitudedoubleREQUIRED
.appt_timedatetimeformat = "2020-06-11 14:48:49.403"
.pickup_time--Read Only
.phone_numberstring
funding_source_namestringREQUIRED
space_typestringREQUIRED
billable_distancedoubleDistance in miles. If no value is passed, MediRoutes will calculate the mileage using the Transportation Provider's distance settings and Bing Maps API. If a value is passed, MediRoutes will accept the provided value and will not calculate a distance.
phonestring
trip_typestring"2" = Appointment, "3" = Return, "1" = Will CallREQUIRED
additional_passengers-
.space_typestring
.countintTypically AMB.

POST Appointment Trip Sample

{
  "tp_api_key": "56e1015d588fgdpf448384b6b3a345dfgd564", 
  "trip_id": "TripApptTest3-10", 
  "rider_id": "rider90", 
  "pickup": {
    "event_name": "Doe, Jane - Pickup Appointment",
    "event_comment": "Drop off the patient in the back of building",
    "complete_address": "2882 N Scottsdale Rd, Scottsdale, AZ 85257",
    "event_location": {
      "location_name": "Honor Health Scottsdale",
      "address1": "",
      "address2": "",
      "city": "",
      "state": "",
      "zip": "",
      "longitude": -111.9287566,
      "latitude": 33.4799636 
    },
    "pickup_time": "2020-04-10 14:48:49.403",
    "phone_number": "520.234.2342"
  },
  "dropoff": {
    "event_name": "Doe, Jane - Dropoff Appointment",
    "event_comment": "Patient's caretaker can be reached at 602.123.1234 if needed upon arrival",
    "complete_address": "",
    "event_location": {
      "location_name": "XYZ Retirement Community",
      "address1": "6606 W Camelback Rd",
      "address2": "Unit 123",
      "city": "Glendale",
      "state": "AZ",
      "zip": "85301",
      "longitude": -112.2035528, 
      "latitude": 33.5097911 
    },
    "appt_time": "04/10/2020 3:00PM", 
    "phone_number": "502.234.2342"
  },
  "funding_source_name": "Broker ABC", 
  "space_type": "WCH", 
  "billable_distance": 4,
  "phone": "(623)-453-3453",
  "trip_type": "Appointment", 
  "additional_passengers": [
    {
      "space_type": "AMB",
      "count": 1
    }
  ]
}

POST Return Trip Sample

{
  "tp_api_key": "56e1015d588fgdpf448384b6b3a345dfgd564", 
  "trip_id": "ReturnSample-11", 
  "rider_id": "rider90", 
  "pickup": {
    "event_name": "Doe, Jane - Pickup Return",
    "event_comment": "Pick up the patient in the back of building",
    "complete_address": "2882 N Scottsdale Rd, Scottsdale, AZ 85257",
    "event_location": {
      "location_name": "Honor Health Scottsdale",
      "address1": "",
      "address2": "",
      "city": "",
      "state": "",
      "zip": "",
      "longitude": -111.9287566,
      "latitude": 33.4799636 
    },
    "pickup_time": "2020-04-10 14:48:49.403",
    "phone_number": "520.234.2342"
  },
  "dropoff": {
    "event_name": "Doe, Jane - Dropoff Return",
    "event_comment": "Patient's caretaker can be reached at 602.123.1234 if needed upon arrival",
    "complete_address": "",
    "event_location": {
      "location_name": "XYZ Retirement Community",
      "address1": "6606 W Camelback Rd",
      "address2": "Unit 123",
      "city": "Glendale",
      "state": "AZ",
      "zip": "85301",
      "longitude": -112.2035528, 
      "latitude": 33.5097911 
    },
    "phone_number": "502.234.2342"
  },
  "funding_source_name": "Broker ABC", 
  "space_type": "WCH", 
  "billable_distance": 4,
  "phone": "(623)-453-3453",
  "trip_type": "Return", 
  "additional_passengers": [
    {
      "space_type": "AMB",
      "count": 1
    }
  ]
}

POST Will Call Trip Sample

Please Note: For Will Call trips, pickup_time is required and must have a date and time. Time is required to be 11:59PM to denote Will Call. Additionally, trip_type = "willcall".

{
  "tp_api_key": "56e1015d588fgdpf448384b6b3a345dfgd564", 
  "trip_id": "WillcallSample-12", 
  "rider_id": "rider90", 
  "pickup": {
    "event_name": "Doe, Jane - Pickup Return",
    "event_comment": "Pick up the patient in the back of building",
    "complete_address": "2882 N Scottsdale Rd, Scottsdale, AZ 85257",
    "event_location": {
      "location_name": "Honor Health Scottsdale",
      "address1": "",
      "address2": "",
      "city": "",
      "state": "",
      "zip": "",
      "longitude": -111.9287566,
      "latitude": 33.4799636 
    },
    "pickup_time": "2020-04-10 23:59",
    "phone_number": "520.234.2342"
  },
  "dropoff": {
    "event_name": "Doe, Jane - Dropoff Return",
    "event_comment": "Patient's caretaker can be reached at 602.123.1234 if needed upon arrival",
    "complete_address": "",
    "event_location": {
      "location_name": "XYZ Retirement Community",
      "address1": "6606 W Camelback Rd",
      "address2": "Unit 123",
      "city": "Glendale",
      "state": "AZ",
      "zip": "85301",
      "longitude": -112.2035528, 
      "latitude": 33.5097911 
    },
    "phone_number": "502.234.2342"
  },
  "funding_source_name": "Broker ABC", 
  "space_type": "WCH", 
  "billable_distance": 4,
  "phone": "(623)-453-3453",
  "trip_type": "Willcall", 
  "additional_passengers": [
    {
      "space_type": "AMB",
      "count": 1
    }
  ]
}

Expected Response Codes

CodeDescription
200Request was successful; Returns trip object.
400Bad Data; If Pickup Time is later than the Appointment time, for example.
401"You do not have access to this resource." Request was unsuccessful.
500Unknown error; Contact MediRoutes.