Skip to content

VariableService

Method LWM2M request Description
getAddress GET /1029/{variableId}/0
alias: /variable/{variableId}/address
Get variable address
getBundleId GET /1029/{variableId}/6
alias: /variable/{variableId}/bundle/id
Get variable bundle id
getBundleValues GET /1029/{variableId}/7
alias: /variable/{variableId}/bundle/values
Get variable bundle values (formated as a TLV)
getCurrentAccess GET /1029/{variableId}/3
alias: /variable/{variableId}/current-access
Get access rights for the variable
getFormat GET /1029/{variableId}/1
alias: /variable/{variableId}/format
Get data format for variable
getNumberOfElements GET /1029/{variableId}/2
alias: /variable/{variableId}/number-of-elements
Get variable array size
getValue GET /1029/{variableId}/4
alias: /variable/{variableId}/value
Get variable value
putAddress PUT /1029/{variableId}/0
alias: /variable/{variableId}/address
Write variable address
putBundleId PUT /1029/{variableId}/6
alias: /variable/{variableId}/bundle/id
Write variable bundle id
putFormat PUT /1029/{variableId}/1
alias: /variable/{variableId}/format
Set data format of the variable
putNumberOfElements PUT /1029/{variableId}/2
alias: /variable/{variableId}/number-of-elements
Write variable array size
putValue PUT /1029/{variableId}/4
alias: /variable/{variableId}/value
Set variable value
setValue POST /1029/{variableId}/5
alias: /variable/{variableId}/set-value
Set variable value

getAddress

Minimal Tap Firmware version: >= 1.0

Get variable address

Example

let myService = new VariableService();
let variableId = 56; // Integer | ID of the variable

try{
    let call = myService.getAddress(variableId);
    let value = (await call).body();
    console.log(`getAddress: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | ID of the variable
try {
    Call<Integer> call = myService.getAddress(variableId);
    Response<Integer> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#getAddress");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Integer> = try tap.service.variable.getAddress(variableId);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer ID of the variable

Return type

Integer

Authorization

No authorization required

getBundleId

Minimal Tap Firmware version: >= 1.0

Get variable bundle id

ID du bundle qui contient la variable

Example

let myService = new VariableService();
let variableId = 56; // Integer | 

try{
    let call = myService.getBundleId(variableId);
    let value = (await call).body();
    console.log(`getBundleId: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | 
try {
    Call<Integer> call = myService.getBundleId(variableId);
    Response<Integer> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#getBundleId");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Integer> = try tap.service.variable.getBundleId(variableId);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer

Return type

Integer

Authorization

No authorization required

getBundleValues

Minimal Tap Firmware version: >= 1.0

Get variable bundle values (formated as a TLV)

Example

let myService = new VariableService();
let variableId = 56; // Integer | 

try{
    let call = myService.getBundleValues(variableId);
    let value = (await call).body();
    console.log(`getBundleValues: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | 
try {
    Call<Bytes> call = myService.getBundleValues(variableId);
    Response<Bytes> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#getBundleValues");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Bytes> = try tap.service.variable.getBundleValues(variableId);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer

Return type

Bytes

Authorization

No authorization required

getCurrentAccess

Minimal Tap Firmware version: >= 1.0

Get access rights for the variable

Get access rights for the variable (read and write)

Example

let myService = new VariableService();
let variableId = 56; // Integer | ID of the variable

try{
    let call = myService.getCurrentAccess(variableId);
    let value = (await call).body();
    console.log(`getCurrentAccess: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | ID of the variable
try {
    Call<ReadWriteRights> call = myService.getCurrentAccess(variableId);
    Response<ReadWriteRights> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#getCurrentAccess");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<ReadWriteRights> = try tap.service.variable.getCurrentAccess(variableId);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer ID of the variable

Return type

ReadWriteRights

Authorization

No authorization required

getFormat

Minimal Tap Firmware version: >= 1.0

Get data format for variable

Example

let myService = new VariableService();
let variableId = 56; // Integer | ID of the variable

try{
    let call = myService.getFormat(variableId);
    let value = (await call).body();
    console.log(`getFormat: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | ID of the variable
try {
    Call<Integer> call = myService.getFormat(variableId);
    Response<Integer> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#getFormat");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Integer> = try tap.service.variable.getFormat(variableId);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer ID of the variable

Return type

Integer

Authorization

No authorization required

getNumberOfElements

Minimal Tap Firmware version: >= 1.0

Get variable array size

Get the number of element of the variable

Example

let myService = new VariableService();
let variableId = 56; // Integer | ID of the variable

try{
    let call = myService.getNumberOfElements(variableId);
    let value = (await call).body();
    console.log(`getNumberOfElements: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | ID of the variable
try {
    Call<Integer> call = myService.getNumberOfElements(variableId);
    Response<Integer> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#getNumberOfElements");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Integer> = try tap.service.variable.getNumberOfElements(variableId);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer ID of the variable

Return type

Integer

Authorization

No authorization required

getValue

Minimal Tap Firmware version: >= 1.0

Get variable value

Value of array of values. The size depends of variable format

Example

let myService = new VariableService();
let variableId = 56; // Integer | ID of the variable

try{
    let call = myService.getValue(variableId);
    let value = (await call).body();
    console.log(`getValue: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | ID of the variable
try {
    Call<Bytes> call = myService.getValue(variableId);
    Response<Bytes> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#getValue");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Bytes> = try tap.service.variable.getValue(variableId);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer ID of the variable

Return type

Bytes

Authorization

No authorization required

putAddress

Minimal Tap Firmware version: >= 1.0

Write variable address

Example

let myService = new VariableService();
let variableId = 56; // Integer | ID of the variable
let address = 56; // Integer | New address of the variable

try{
    let call = myService.putAddress(variableId, address);
    let value = (await call).body();
    console.log(`putAddress: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | ID of the variable
Integer address = 56; // Integer | New address of the variable
try {
    Call<Void> call = myService.putAddress(variableId, address);
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#putAddress");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Any> = try tap.service.variable.putAddress(variableId, address);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer ID of the variable
address Integer New address of the variable

Return type

null (empty response body)

Authorization

No authorization required

putBundleId

Minimal Tap Firmware version: >= 1.0

Write variable bundle id

Example

let myService = new VariableService();
let variableId = 56; // Integer | 
let value = 56; // Integer | 

try{
    let call = myService.putBundleId(variableId, value);
    let value = (await call).body();
    console.log(`putBundleId: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | 
Integer value = 56; // Integer | 
try {
    Call<Void> call = myService.putBundleId(variableId, value);
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#putBundleId");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Any> = try tap.service.variable.putBundleId(variableId, value);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer
value Integer

Return type

null (empty response body)

Authorization

No authorization required

putFormat

Minimal Tap Firmware version: >= 1.0

Set data format of the variable

Example

let myService = new VariableService();
let variableId = 56; // Integer | ID of the variable
let value = 56; // Integer | New format of the variable

try{
    let call = myService.putFormat(variableId, value);
    let value = (await call).body();
    console.log(`putFormat: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | ID of the variable
Integer value = 56; // Integer | New format of the variable
try {
    Call<Void> call = myService.putFormat(variableId, value);
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#putFormat");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Any> = try tap.service.variable.putFormat(variableId, value);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer ID of the variable
value Integer New format of the variable

Return type

null (empty response body)

Authorization

No authorization required

putNumberOfElements

Minimal Tap Firmware version: >= 1.0

Write variable array size

Set the number of element of the variable

Example

let myService = new VariableService();
let variableId = 56; // Integer | ID of the variable
let value = 56; // Integer | New number of element for this variable

try{
    let call = myService.putNumberOfElements(variableId, value);
    let value = (await call).body();
    console.log(`putNumberOfElements: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | ID of the variable
Integer value = 56; // Integer | New number of element for this variable
try {
    Call<Void> call = myService.putNumberOfElements(variableId, value);
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#putNumberOfElements");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Any> = try tap.service.variable.putNumberOfElements(variableId, value);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer ID of the variable
value Integer New number of element for this variable

Return type

null (empty response body)

Authorization

No authorization required

putValue

Minimal Tap Firmware version: >= 1.0

Set variable value

Example

let myService = new VariableService();
let variableId = 56; // Integer | ID of the variable
let value = BINARY_DATA_HERE; // Bytes | 

try{
    let call = myService.putValue(variableId, value);
    let value = (await call).body();
    console.log(`putValue: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | ID of the variable
Bytes value = BINARY_DATA_HERE; // Bytes | 
try {
    Call<Void> call = myService.putValue(variableId, value);
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#putValue");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Any> = try tap.service.variable.putValue(variableId, value);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer ID of the variable
value BytesBytes

Return type

null (empty response body)

Authorization

No authorization required

setValue

Minimal Tap Firmware version: >= 1.0

Set variable value

Difference with put ?

Example

let myService = new VariableService();
let variableId = 56; // Integer | ID of the variable
let value = BINARY_DATA_HERE; // Bytes | 

try{
    let call = myService.setValue(variableId, value);
    let value = (await call).body();
    console.log(`setValue: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .VariableService;

ServiceFactory serviceFactory = ...;
VariableService myService = serviceFactory.create(VariableService.class);


Integer variableId = 56; // Integer | ID of the variable
Bytes value = BINARY_DATA_HERE; // Bytes | 
try {
    Call<Void> call = myService.setValue(variableId, value);
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling VariableService#setValue");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Any> = try tap.service.variable.setValue(variableId, value);
print("Response:" + response.body())

Parameters

Name Type Description Notes
variableId Integer ID of the variable
value BytesBytes

Return type

null (empty response body)

Authorization

No authorization required