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:
object
Title:
Collection of Resource Positions
The collection of resource positions.
Show Source
-
items(required):
array Items
Title:
Items
Maximum Number of Items:300
An array of items containing the position information of one or more resources.
Nested Schema : Items
Type:
array
Title:
Items
Maximum Number of Items:
300
An 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 Item
The request body parameters of this operation.
Nested Schema : Set Resources Position Request Item
Type:
object
Title:
Set Resources Position Request Item
The request body parameters of this operation.
Show Source
-
acc:
integer
Title:
Accuracy
Minimum Value:0
The accuracy of the position in meters. -
alt:
integer
Title:
Altitude
Minimum Value:0
The altitude of the position (in meters) above the World Geodetic System (WGS) 84 reference ellipsoid. -
dir:
number
Title:
Direction
Minimum Value:0
Maximum Value:360
The direction (in degrees) in which the vehicle is headed. Only one digit after the decimal point is considered. -
lat(required):
number
Title:
Latitude
Minimum Value:-90
Maximum Value:90
The latitude coordinate of the resource position. A maximum of five digits after the decimal point are considered. -
lng(required):
number
Title:
Longitude
Minimum Value:-180
Maximum Value:180
The longitude coordinate of the resource position. A maximum of five digits after the decimal point are considered. -
resourceId(required):
string
Title:
Resource ID
The external identifier of the resource. -
spd:
number
Title:
Speed
Minimum Value:0
The vehicle speed in meters per second. Only one digit after the decimal point is considered. -
time(required):
string(timestamp-date-time-iso8601)
Title:
Time
The 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:
object
Title:
Summary of Processed Points
The summary of the successfully processed items and the failed items.
Show Source
-
errors:
array Errors
Title:
Errors
The list of failed items with their corresponding error messages. -
itemsFailed:
integer
Title:
Items Failed
Minimum Value:0
The number of failed items. -
itemsProcessed:
integer
Title:
Items Processed
Minimum Value:0
The number of successfully processed items.
Nested Schema : Errors
Type:
array
Title:
Errors
The list of failed items with their corresponding error messages.
Show Source
-
Array of:
object Error
Title:
Error
The details of the error.
Nested Schema : Error
Type:
object
Title:
Error
The details of the error.
Show Source
-
itemIndex:
integer
Title:
Index of Failed Item
The index of the failed item. -
message:
string
Title:
Error Message
The 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" } ] }