BatchUpdateDevicePositionCommand

Uploads position update data for one or more devices to a tracker resource (up to 10 devices per batch). Amazon Location uses the data when it reports the last known device position and position history. Amazon Location retains location data for 30 days.

Position updates are handled based on the PositionFiltering property of the tracker. When PositionFiltering is set to TimeBased, updates are evaluated against linked geofence collections, and location data is stored at a maximum of one position per 30 second interval. If your update frequency is more often than every 30 seconds, only one update per 30 seconds is stored for each unique device ID.

When PositionFiltering is set to DistanceBased filtering, location data is stored and evaluated against linked geofence collections only if the device has moved more than 30 m (98.4 ft).

When PositionFiltering is set to AccuracyBased filtering, location data is stored and evaluated against linked geofence collections only if the device has moved more than the measured accuracy. For example, if two consecutive updates from a device have a horizontal accuracy of 5 m and 10 m, the second update is neither stored or evaluated if the device has moved less than 15 m. If PositionFiltering is set to AccuracyBased filtering, Amazon Location uses the default value { "Horizontal": 0} when accuracy is not provided on a DevicePositionUpdate.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { LocationClient, BatchUpdateDevicePositionCommand } from "@aws-sdk/client-location"; // ES Modules import
// const { LocationClient, BatchUpdateDevicePositionCommand } = require("@aws-sdk/client-location"); // CommonJS import
const client = new LocationClient(config);
const input = { // BatchUpdateDevicePositionRequest
  TrackerName: "STRING_VALUE", // required
  Updates: [ // DevicePositionUpdateList // required
    { // DevicePositionUpdate
      DeviceId: "STRING_VALUE", // required
      SampleTime: new Date("TIMESTAMP"), // required
      Position: [ // Position // required
        Number("double"),
      ],
      Accuracy: { // PositionalAccuracy
        Horizontal: Number("double"), // required
      },
      PositionProperties: { // PositionPropertyMap
        "<keys>": "STRING_VALUE",
      },
    },
  ],
};
const command = new BatchUpdateDevicePositionCommand(input);
const response = await client.send(command);
// { // BatchUpdateDevicePositionResponse
//   Errors: [ // BatchUpdateDevicePositionErrorList // required
//     { // BatchUpdateDevicePositionError
//       DeviceId: "STRING_VALUE", // required
//       SampleTime: new Date("TIMESTAMP"), // required
//       Error: { // BatchItemError
//         Code: "STRING_VALUE",
//         Message: "STRING_VALUE",
//       },
//     },
//   ],
// };

BatchUpdateDevicePositionCommand Input

Parameter
Type
Description
TrackerName
Required
string | undefined

The name of the tracker resource to update.

Updates
Required
DevicePositionUpdate[] | undefined

Contains the position update details for each device, up to 10 devices.

BatchUpdateDevicePositionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
Errors
Required
BatchUpdateDevicePositionError[] | undefined

Contains error details for each device that failed to update its position.

Throws

Name
Fault
Details
AccessDeniedException
client

The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.

InternalServerException
server

The request has failed to process because of an unknown server error, exception, or failure.

ResourceNotFoundException
client

The resource that you've entered was not found in your AWS account.

ThrottlingException
client

The request was denied because of request throttling.

ValidationException
client

The input failed to meet the constraints specified by the AWS service.

LocationServiceException
Base exception class for all service exceptions from Location service.