Set positions for resources
post
/rest/ofscCore/v1/resources/custom-actions/setPositions
This operation sets resource positions for the specified resources. A maximum of 300 items are allowed in a single request.
This method uses regular OAuth 2.0 authentication on behalf of user or application:
- In case of when the OAuth 2.0 access token is issued on behalf of a specific user the only available resource for updating its positions is main resource specified for this user.
- In case of authentication with application there are options to allow posting positions for all resources (default) or to configure a list of available (visible) resources to post positions for. Available (visible) resources (or buckets) can be specified in Core application - Configuration >> Applications >> [Specific application] >> Additional restrictions >> Allow access only to certain resources.
Request
Root Schema : Collection of Resource Positions
Type:
objectTitle:
Collection of Resource PositionsThe collection of resource positions.
Show Source
-
items(required):
array Items
Title:
ItemsMaximum Number of Items:300An array of items containing the position information of one or more resources.
Nested Schema : Items
Type:
arrayTitle:
ItemsMaximum Number of Items:
300An array of items containing the position information of one or more resources.
Show Source
-
Array of:
object Set Resources Position Request Item
Title:
Set Resources Position Request ItemThe request body parameters of this operation.
Nested Schema : Set Resources Position Request Item
Type:
objectTitle:
Set Resources Position Request ItemThe request body parameters of this operation.
Show Source
-
acc:
integer
Title:
AccuracyMinimum Value:0The accuracy of the position in meters. -
alt:
integer
Title:
AltitudeMinimum Value:0The altitude of the position (in meters) above the World Geodetic System (WGS) 84 reference ellipsoid. -
dir:
number
Title:
DirectionMinimum Value:0Maximum Value:360The direction (in degrees) in which the vehicle is headed. Only one digit after the decimal point is considered. -
lat(required):
number
Title:
LatitudeMinimum Value:-90Maximum Value:90The latitude coordinate of the resource position. A maximum of five digits after the decimal point are considered. -
lng(required):
number
Title:
LongitudeMinimum Value:-180Maximum Value:180The longitude coordinate of the resource position. A maximum of five digits after the decimal point are considered. -
resourceId(required):
string
Title:
Resource IDThe external identifier of the resource. -
spd:
number
Title:
SpeedMinimum Value:0The vehicle speed in meters per second. Only one digit after the decimal point is considered. -
time(required):
string(timestamp-date-time-iso8601)
Title:
TimeThe date in the Internet Date-Time format or integer UNIX timestamp. For example, 2016-09-20T11:37:29Z or 1476267764.
Response
Supported Media Types
- application/json
200 Response
This section describes the 200 status response for this operation.
Root Schema : Summary of Processed Points
Type:
objectTitle:
Summary of Processed PointsThe summary of the successfully processed items and the failed items.
Show Source
-
errors:
array Errors
Title:
ErrorsThe list of failed items with their corresponding error messages. -
itemsFailed:
integer
Title:
Items FailedMinimum Value:0The number of failed items. -
itemsProcessed:
integer
Title:
Items ProcessedMinimum Value:0The number of successfully processed items.
Nested Schema : Errors
Type:
arrayTitle:
ErrorsThe list of failed items with their corresponding error messages.
Show Source
-
Array of:
object Error
Title:
ErrorThe details of the error.
Nested Schema : Error
Type:
objectTitle:
ErrorThe details of the error.
Show Source
-
itemIndex:
integer
Title:
Index of Failed ItemThe index of the failed item. -
message:
string
Title:
Error MessageThe error message of the failed item.
Default Response
This section describes the default error response for this operation.
Root Schema : Error
Type:
Show Source
object-
detail:
string
The detailed description of this error.
-
status:
string
The HTTP status code of this error.
-
title(required):
string
The brief description of this error.
-
type(required):
string
The URL of the web page containing more details about this error.
Examples
The following example shows how to set resource positions for specified resources by submitting a POST request on the REST resource using cURL:
cURL command Example
curl -X 'POST' \
https://<instance_name>.fs.ocs.oraclecloud.com/rest/ofscCore/v1/resources/custom-actions/setPositions \
-H 'Authorization: Bearer eyJ0eXAiO...rest of the access token skipped for brevity' \
-H 'Content-Type: application/json' \
--data-binary '{
"items": [
{
"resourceId": "set_position3",
"time": "2018-06-27T09:00:40+0300",
"lat": 49.9770569,
"lng": 36.277882899999994
},
{
"resourceId": "set_position4",
"time": "2018-06-27T09:00:57+0300",
"lat": 49.9780569,
"lng": 36.27888289999999
}
]
}'Response Header Example
The following shows an example of the response header.
HTTP/1.1 200 OK Server: nginx/1.2.7 Date: Wed, 27 Jun 2018 12:44:50 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive
Response Body Example
The following shows an example of the response body in JSON format.
{
"itemsProcessed": 2,
"itemsFailed": 0,
"links": [
{
"rel": "canonical",
"href": "https://<instance_name>.fs.ocs.oraclecloud.com/rest/ofscCore/v1/resources/custom-actions/setPositions"
}
]
}