• Home
  • Guides
  • Reference
  • Support

    Show / Hide Table of Contents
    • API Overview
      • Overview
      • Authentication
      • Retrieving API Results
      • Referenced vs Inline Entities
      • Choosing API Response Data
      • Handling API Errors
    • separator
    • Vehicle Routing Endpoints
      • Path
    • Optimization Endpoints
      • Instantiate
      • Build
      • Assignment Restrictions
      • Optimize
      • Sequence
      • Evaluate
      • Recommend
      • Insert
      • Centroids
      • Zones
      • Consolidate By Job Restrictions
      • Consolidate By Route Assignments
    • Geocoding Endpoints
      • Geocode
      • Reverse Geocode
    • Task Endpoints
      • List
      • Status
      • Result
      • Cancel
    • Sandbox Endpoints
      • List
      • Create
      • Rename
      • Retrieve
      • Update
      • Delete
      • Revisions
      • Add Revision
      • Expiry
      • Permissions
    • Verizon Connect Fleet Integration Endpoints
      • Pull Platform Data
      • Sync Platform Data
      • List Platform Territories
    • Other Endpoints
      • Canonicalize
      • Route Cards
      • Validate
      • Version
    • separator
    • Request Types
      • problem
      • capacity_metric
      • depot
      • driver
      • driver_break
      • job
      • job_template
      • job_type
      • load_amount
      • marker
      • problem_defaults
      • route
      • schedule
      • settings
      • shift
      • shift_override
      • shift_pattern
      • shift_pattern_assignment
      • stop
      • vehicle
      • zone
      • variance
    • Response Types
      • instantiate_response
      • problem_response
      • problem_aggregates
      • driver_response
      • geocoded_location
      • recommend_option
      • route_response
      • schedule_response
      • schedule_instantiate_response
      • stop_response
      • violation
    • Meta Types
      • task_redirect_response
      • task_status_response
      • validate_response
    • Sandbox Types
      • delta
      • array_delta
      • dict_delta
      • keyed_array_delta
      • object_delta
      • set_delta
      • revision
      • revision_created_response
      • revision_response
      • sandbox_response
    • Common Types
      • date_range
      • day_of_week
      • hazmat_load_type
      • id
      • latlon
      • stop_type
      • time_window
      • custom
      • polygon
    • Primitive Types
      • boolean
      • date
      • datetime
      • float
      • integer
      • string
      • timespan

    keyed_array_delta

    A keyed_array_delta is a type of delta that creates, updates, or deletes objects in an array, where objects can be identified by an ID. A keyed_array_delta can be used on the problem.routes, route.breaks, or job.loads fields, for example. If multiple operations are specified, the fields are applied in the following order: unassign, assign, assign_template. When modifying a top-level collection (for example, problem.routes), one and only one of unassign, assign, or assign_template can be specified, as this allows API clients to reliably distinguish between creates, updates, and deletes of top-level entities.

    Name Type Description
    $collection string Required. Must be "keyed_array" for a keyed_array_delta.
    $create boolean Optional. Defaults to true. If the delta is attempting to modify a non-existent object, create it first.
    $path string Required on top-level deltas. The JSON path to modify. See Paths for a list of valid paths.
    assign delta[] Optional. Create or update entities.
    assign_template delta Optional. Bulk create or update entities, using the IDs specified by ids.
    ids delta[] Optional. The IDs to use with assign_template.
    key string Optional. Defaults to id. The field to use as the key. For example, when modifying job.loads, the key is metric.
    unassign string[] Optional. Remove the entities from the problem matching these ids.

    Examples

    A revision for modifying route.load_capacities and route.breaks using a keyed_array_delta:

    {
      "deltas": [{
        "$path": ["route"],
        "$collection": "keyed_array",
        "ids": ["route0", "route1"],
        "assign": {
          "load_capacities": {
            "$collection": "keyed_array",
            "key": "metric",
            "assign": [{
              "metric": "kg",
              "amount": 123,
            }],
          },
          "breaks": {
            "$collection": "keyed_array",
            "key": "id",
            "assign": [{
              "id": "lunch",
              "start": "13:00",
            }],
            "unassign": ["dinner"], // bulk remove dinner break
          },
        },
      }]
    }
    

    See Also

    • delta.
    • Sandboxes.