Skip to content
  • Get distance in batch

    Request

    Submit a batch request to find the distance and general drive time between two points.

    Headers
    Acceptstringrequired

    Format of the response.

    Enum:"application/json""*/*"
    Example:application/json
    Content-Typestringrequired

    Format of the request.

    Enum:"application/json""application/xml"
    Bodyapplication/jsonrequired

    Street Route Request Body

    CustomerIDstringrequired

    Required. The License Key issued by Melissa.

    Example:"{REPLACE-WITH-YOUR-LICENSE-KEY}"
    Optionsstring

    Options - List options in the following format, with multiple options delimited with a ,. For example: optionName:parameter,optionName:parameter. These options are case-sensitive and camel case.

    • arriveAt:< yyyy-mm-ddThh:mm:ss.mmmZ > - Specify the arrival time ISO 8601 UTC.

    • avoid:< borderCrossings | ferries | tollRoads | tunnels | unpavedRoads > - Specify the types of transport obstacles to avoid.

    • departAt:< yyyy-mm-ddThh:mm:ss.mmmZ | now > - Specify the departure date and time in ISO 8601 UTC. Default is now - departs immediately.

    • routeType:< eco | fastest | shortest | thrilling > - Specify the type of route.

      • eco - Balances travel time and fuel efficiency.
      • fastest - Optimizes for fastest travel time.
      • shortest - Optimizes for shortest travel distance.
      • thrilling - Optimized for challenging, hilly, or winding routes.
    • traffic:< false | true > - Considers current traffic conditions. Default is true.

    • travelMode:< bicycle | car | pedestrian > - Specify the type of vehicle used for the travel mode. Default is car.

    • vehicleCommercial:< false | true > - Indicates if the vehicle is a commercial vehicle. Default is false.

    • vehicleHeight:< [float] | 0 > - Specifies the vehicle height in meters. There are no height restrictions. Default is 0.

    • vehicleLength:< [float] | 0 > - Specifies the vehicle length in meters. Default is 0.

    • vehicleMaxSpeed:< [integer] | 0 > - Specifies the maximum vehicle speed in km/hr. Default is 0.

    • vehicleWeight:< [integer] | 0 > - Specifies the vehicle weight in kilograms. Minimum value is 1.

    Example:"avoid:tunnels,routeType:shortest"
    TransmissionReferencestring

    Transmission Reference - Serves as a unique request identifier. It is returned as sent.

    Example:"Test"
    Unitsstring

    Units - This specifies the returned distance unit scale. Use mi for miles and km for kilometers.

    Default:"mi"
    Enum:"mi""km"
    Example:"mi"
    RecordsArray of objects, [ 1 .. 100 ] itemsrequired

    Array of request records.

    curl -i -X POST \
      https://streetroute.melissadata.net/v1/WEB/StreetRoute/getDistance \
      -H 'Accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
        "CustomerID": "{REPLACE-WITH-YOUR-LICENSE-KEY}",
        "Options": "avoid:tunnels,routeType:shortest",
        "TransmissionReference": "Test",
        "Units": "mi",
        "Records": [
          {
            "RecordID": "1",
            "StartLatitude": "33.637520",
            "StartLongitude": "-117.606920",
            "EndLatitude": "33.649870",
            "EndLongitude": "-117.582960"
          },
          {
            "RecordID": "2",
            "StartLatitude": "40.712776",
            "StartLongitude": "-74.005974",
            "EndLatitude": "34.052235",
            "EndLongitude": "-118.243683"
          }
        ]
      }'

    Responses

    Default response from a POST request

    Bodyapplication/json
    Versionstring

    The current service version number.

    Unitsstring

    This is a string value that is the set unit of measurement for the TotalDrivingDistance field.

    TransmissionReferencestring

    A pass-through of the input TransmissionReference field.

    TransmissionResultstring

    Lists error codes from any errors caused by the most recent request as a whole. For more information, see Street Route Result Codes.

    TotalRecordsstring

    Total number of records.

    RecordsArray of objects

    Array of output records.

    Response
    { "Version": "8.2.1.0", "Units": "mi", "TransmissionReference": "Test", "TransmissionResult": "", "TotalRecords": "2", "Records": [ { … }, { … } ] }