Update Vehicle Type by ID
post
/fleetMonitoring/clientapi/v2/vehicleTypes/{type-id}
This operation updates the vehicle type specified by its ID.
Request
Supported Media Types
- application/json
Path Parameters
-
type-id: string
Vehicle Type ID
Header Parameters
-
X-HTTP-Method-Override: string
Entity description is undefined
-
X-ORACLE-IOT-ORG(optional): string
To allow targeting requests to different organizations. The header value should contain the organization identifier(orgId). This header is optional, if not provided orgId will be ORA_DEFAULT_ORG
Root Schema : VehicleType_update
Type:
Show Source
object
-
attributes(optional):
array attributes
Attributes associated with this vehicle type. Attributes could be custom or sensor based
-
description(optional):
string
Description about the vehicle type.
-
make(optional):
string
Make of the vehicle type.
-
model(optional):
string
Model of the vehicle type.
-
name(optional):
string
Name of the vehicle type. It must be unique.
-
years(optional):
array years
Range of years for the vehicle type.
Nested Schema : attributes
Type:
array
Attributes associated with this vehicle type. Attributes could be custom or sensor based
Show Source
Nested Schema : VehicleAttributes_update
Type:
Show Source
object
-
allowedValues(optional):
array allowedValues
Allowed values for the attribute.
-
dataType(optional):
string
Data type of the attribute. One of [STRING, NUMBER, BOOLEAN, DATE, BINARY].
-
deviceModel(optional):
string
Device model URN for the message format field this attribute is mapped to. It is mandatory for the attribute of the type sensor.
-
instructions(optional):
string
Instructions on how to fill the vehicle type attributes.
-
messageFormat(optional):
string
Message format URN which the field is mapped. For attributes of SENSOR type this attribute is mandatory.
-
messageFormatField(optional):
string
Message format field to which this attributes is mapped. For attributes of SENSOR type this is mandatory.
-
name(optional):
string
Name of the attribute.
-
required(optional):
boolean
Boolean value for whether the attribute if required or optional.
-
unique(optional):
boolean
Boolean value for whether the attribute is unique or not.
Nested Schema : items
Type:
object
Response
Supported Media Types
- application/json
- application/vnd.oracle.resource+json;type=singular
200 Response
Successfully processed.
Root Schema : VehicleType_receive
Type:
Show Source
object
-
attributes:
array attributes
Attributes associated with this vehicle type. Attributes could be custom or sensor based
-
description:
string
Description about the vehicle type.
-
icon:
object icon
Binary object representing the vehicle type icon.
-
id:
string
Unique Identifier of vehicle type.
-
lastModifiedTimeAsString:
string
Modified time as string
-
make:
string
Make of the vehicle type.
-
model:
string
Model of the vehicle type.
-
name:
string
Name of the vehicle type. It must be unique.
-
registrationTimeAsString:
string
Registration time as string.
-
years:
array years
Range of years for the vehicle type.
Nested Schema : attributes
Type:
array
Attributes associated with this vehicle type. Attributes could be custom or sensor based
Show Source
Nested Schema : icon
Type:
object
Binary object representing the vehicle type icon.
Show Source
-
links(optional):
array links
The set of API navigation links.
Nested Schema : VehicleAttributes_receive
Type:
Show Source
object
-
allowedValues:
array allowedValues
Allowed values for the attribute.
-
dataType:
string
Data type of the attribute. One of [STRING, NUMBER, BOOLEAN, DATE, BINARY].
-
deviceModel:
string
Device model URN for the message format field this attribute is mapped to. It is mandatory for the attribute of the type sensor.
-
instructions:
string
Instructions on how to fill the vehicle type attributes.
-
messageFormat:
string
Message format URN which the field is mapped. For attributes of SENSOR type this attribute is mandatory.
-
messageFormatField:
string
Message format field to which this attributes is mapped. For attributes of SENSOR type this is mandatory.
-
name:
string
Name of the attribute.
-
required:
boolean
Boolean value for whether the attribute if required or optional.
-
type:
string
Attribute Type. One of [CUSTOM, SENSOR].
-
unique:
boolean
Boolean value for whether the attribute is unique or not.
Nested Schema : items
Type:
object
Nested Schema : items
Type:
Show Source
object
-
href(optional):
string
The target resource URIExample:
https://iotserver/iot/api/vX/some/API/path
-
rel(optional):
string
Relation typeExample:
canonical
400 Response
Bad Request. The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
401 Response
Unauthorized. The request requires user authentication.
403 Response
Forbidden. The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated.
404 Response
Not Found. The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
Examples
curl -X POST
-u <username>:<password>
-H 'Accept: application/json'
-H 'Content-Type: application/json'
--header "X-HTTP-Method-Override: PATCH"
https://iotserver/fleetMonitoring/clientapi/v2/vehicleTypes/{type-id}
Example of Request Body
The following example shows the content of the request body in JSON format:
{
"name":"Test_Vehicle_Type",
"description":"Vehicle Type Description",
"make":"Vehicle_Type_Make",
"model":"Vehicle_Type_Model",
"icon":"data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wB",
"years":[
2015,
2016,
2017
],
"attributes":[
{
"name":"TestAttribute_Custom",
"type":"CUSTOM",
"dataType":"STRING",
"required":true,
"allowedValues":[
"Value_1",
"Value_2"
],
"defaultValue":"Value_1"
},
{
"messageFormatField":"ora_obd2_vehicle_speed",
"name":"TestAttribute_Sensor",
"required":false,
"dataType":"NUMBER",
"type":"SENSOR",
"deviceModel":"urn:com:oracle:iot:device:obd2"
}
]
}
Example of Response Body
The following example shows the content of the response body in JSON format:
{
"id": "2F29B565-D2A4-4922-AE40-ED6A3E1F5E8B",
"name": "Test_Vehicle_Type",
"description": "Vehicle Type Description",
"make": "Vehicle_Type_Make",
"model": "Vehicle_Type_Model",
"years": [
2015,
2016,
2017
],
"registrationTimeAsString": "2018-04-16T07:58:16.186Z",
"lastModifiedTimeAsString": "2018-04-16T07:58:16.186Z",
"attributes": [
{
"name": "TestAttribute_Custom",
"dataType": "STRING",
"allowedValues": [
"Value_1",
"Value_2"
],
"defaultValue": "Value_1",
"required": true,
"unique": false,
"type": "CUSTOM"
},
{
"name": "TestAttribute_Sensor",
"dataType": "NUMBER",
"deviceModel": "urn:com:oracle:iot:device:obd2",
"required": false,
"unique": false,
"messageFormatField": "ora_obd2_vehicle_speed",
"type": "SENSOR"
}
],
"links": [
{
"href": "https://iotserver/fleetMonitoring/clientapi/v2/vehicleTypes/2F29B565-D2A4-4922-AE40-ED6A3E1F5E8B",
"rel": "self"
},
{
"href": "https://iotserver/fleetMonitoring/clientapi/v2/vehicleTypes/2F29B565-D2A4-4922-AE40-ED6A3E1F5E8B",
"rel": "canonical"
}
],
"icon": {
"links": [
{
"href": "https://iotserver/fleetMonitoring/clientapi/v2/binary/6A10144B-37FC-45B5-BD6F-070142944B50.image.jpeg",
"rel": "self"
}
]
}
}
Complete cURL Example
The following example shows a complete cURL command that you can use to perform the described operation:
curl -X POST
-u <username>:<password>
-H 'Accept: application/json'
-H 'Content-Type: application/json'
--header "X-HTTP-Method-Override: PATCH"
-d '{"name":"Name of the vehicle type. It must be unique.","description":"Description about the vehicle type.","model":"Model of the vehicle type.","attributes":[{"instructions":"Instructions on how to fill the vehicle type attributes.","messageFormat":"Message format URN which the field is mapped. For attributes of SENSOR type this attribute is mandatory.","unique":false,"dataType":"Data type of the attribute. One of [STRING, NUMBER, BOOLEAN, DATE, BINARY].","name":"Name of the attribute.","messageFormatField":"Message format field to which this attributes is mapped. For attributes of SENSOR type this is mandatory.","deviceModel":"Device model URN for the message format field this attribute is mapped to. It is mandatory for the attribute of the type sensor.","required":false}],"make":"Make of the vehicle type.","years":["years_1","years_2","years_3"]}'
https://iotserver/fleetMonitoring/clientapi/v2/vehicleTypes/3441c7c2cf3-62da
Note that in the request,
https://iotserver
will be replaced by the name and port of your assigned IoT Cloud Service instance. The format of the Cloud Service instance is
https://myinstance-myidentitydomain.iot.us.oraclecloud.com
and the default port is 443.