Viviot.Api

<back to all web services

PutThingStates

Requires Authentication
Requires any of the roles:Admin, TenantAdmin, Receptionist
The following routes are available for this service:
PUT/thing/statesUpdates state(s) of individual things (as a business user).
PutThingStates Parameters:
NameParameterData TypeRequiredDescription
ThingIdbodystringYesThing Id (GUID).
StatesbodyList<StateValue>YesList of state names and their values.
PropertiesbodyDictionary<string, string>NoDictionary with key value pairs of all thing properties.
BaseRequest Parameters:
NameParameterData TypeRequiredDescription
VersionformintegerNoApi version
StateValue Parameters:
NameParameterData TypeRequiredDescription
NameformstringNo
ValueformstringNo
ThingStatesResponse Parameters:
NameParameterData TypeRequiredDescription
DataformThingStateViewNo
BaseResponse Parameters:
NameParameterData TypeRequiredDescription
ResponseStatusformResponseStatusNo
ThingStateView Parameters:
NameParameterData TypeRequiredDescription
ThingIdformGuidNo
OrganizationIdformGuidNo
PropertiesformDictionary<string, Object>No
StatesformDictionary<string, List<StateValueView>>No
ChildThingsformList<ThingStateView>No

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

PUT /thing/states HTTP/1.1 
Host: api.4spaces.io 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	thingId: 00000000000000000000000000000000,
	states: 
	[
		{
			name: String,
			value: String
		}
	],
	properties: 
	{
		String: String
	},
	version: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	data: 
	{
		thingId: 00000000000000000000000000000000,
		organizationId: 00000000000000000000000000000000,
		properties: 
		{
			String: {}
		},
		states: 
		{
			String: 
			[
				{
					ts: -62135596800000,
					value: String
				}
			]
		},
		childThings: 
		[
			{
				thingId: 00000000000000000000000000000000,
				organizationId: 00000000000000000000000000000000,
				properties: 
				{
					String: {}
				},
				states: 
				{
					String: 
					[
						{
							ts: -62135596800000,
							value: String
						}
					]
				},
				childThings: 
				[
					{
						thingId: 00000000000000000000000000000000,
						organizationId: 00000000000000000000000000000000,
						properties: 
						{
							String: {}
						},
						states: 
						{
							String: 
							[
								{
									ts: -62135596800000,
									value: String
								}
							]
						},
						childThings: 
						[
							{
								
							}
						]
					}
				]
			}
		]
	},
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}