Files
maptology/testing/api-client/docs/DeviceApi.md
T
Ole e3935842c7
lbs-gitea/maptology/master There was a failure building this commit
move generated client code in the projects source folder & successfully create devices
2018-01-25 01:33:33 +01:00

17 KiB

DeviceApi

All URIs are relative to http://localhost/api

Method HTTP request Description
addLocations POST /devices/current/locations Updates the locations of the current device.
createDevice POST /devices Creates a new device and returns its handle.
deleteCurrentDevice DELETE /devices/current Deletes the current device.
deleteDevice DELETE /devices/{id} Deletes a device.
getCurrentDevice GET /devices/current Returns the current device.
getCurrentUserDevices GET /users/current/devices Returns the list of devices for the current user.
getDevice GET /devices/{id} Gets a device.
getDeviceLocation GET /devices/{id}/location Gets the last device location.
getDeviceVisits GET /devices/{id}/visits Gets the last device location.
getDevices GET /devices Returns all devices.
setDevice PUT /devices/{id} Sets the values of a device.

addLocations

addLocations(body)

Updates the locations of the current device.

Example

// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: device
ApiKeyAuth device = (ApiKeyAuth) defaultClient.getAuthentication("device");
device.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//device.setApiKeyPrefix("Token");

DeviceApi apiInstance = new DeviceApi();
LocationUpdate body = new LocationUpdate(); // LocationUpdate | The location update with the locations to add.
try {
    apiInstance.addLocations(body);
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceApi#addLocations");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body LocationUpdate The location update with the locations to add.

Return type

null (empty response body)

Authorization

device

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/json, application/xml

createDevice

DeviceHandle createDevice(body)

Creates a new device and returns its handle.

The response will include the auth token to be stored on the device and supplied as authentication on all subsequent api calls. Note that the auth token can not be requested after creation, so when losing the auth token you may lose access to the device data.

Example

// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.DeviceApi;


DeviceApi apiInstance = new DeviceApi();
DeviceInfo body = new DeviceInfo(); // DeviceInfo | Necessary data from to create a device.
try {
    DeviceHandle result = apiInstance.createDevice(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceApi#createDevice");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body DeviceInfo Necessary data from to create a device.

Return type

DeviceHandle

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/json, application/xml

deleteCurrentDevice

deleteCurrentDevice()

Deletes the current device.

Example

// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: device
ApiKeyAuth device = (ApiKeyAuth) defaultClient.getAuthentication("device");
device.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//device.setApiKeyPrefix("Token");

DeviceApi apiInstance = new DeviceApi();
try {
    apiInstance.deleteCurrentDevice();
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceApi#deleteCurrentDevice");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

null (empty response body)

Authorization

device

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/json, application/xml

deleteDevice

deleteDevice(id)

Deletes a device.

Example

// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");

// Configure HTTP basic authorization: user
HttpBasicAuth user = (HttpBasicAuth) defaultClient.getAuthentication("user");
user.setUsername("YOUR USERNAME");
user.setPassword("YOUR PASSWORD");

DeviceApi apiInstance = new DeviceApi();
Long id = 789L; // Long | The device id.
try {
    apiInstance.deleteDevice(id);
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceApi#deleteDevice");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The device id.

Return type

null (empty response body)

Authorization

admin, user

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/json, application/xml

getCurrentDevice

Device getCurrentDevice()

Returns the current device.

Example

// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: device
ApiKeyAuth device = (ApiKeyAuth) defaultClient.getAuthentication("device");
device.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//device.setApiKeyPrefix("Token");

DeviceApi apiInstance = new DeviceApi();
try {
    Device result = apiInstance.getCurrentDevice();
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceApi#getCurrentDevice");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

Device

Authorization

device

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/json, application/xml

getCurrentUserDevices

DevicePage getCurrentUserDevices(pageOffset, pageSize)

Returns the list of devices for the current user.

Example

// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: user
HttpBasicAuth user = (HttpBasicAuth) defaultClient.getAuthentication("user");
user.setUsername("YOUR USERNAME");
user.setPassword("YOUR PASSWORD");

DeviceApi apiInstance = new DeviceApi();
Integer pageOffset = 0; // Integer | The offset in terms of elements.
Integer pageSize = 20; // Integer | The maximum number of elements on the page.
try {
    DevicePage result = apiInstance.getCurrentUserDevices(pageOffset, pageSize);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceApi#getCurrentUserDevices");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
pageOffset Integer The offset in terms of elements. [optional] [default to 0]
pageSize Integer The maximum number of elements on the page. [optional] [default to 20]

Return type

DevicePage

Authorization

user

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/json, application/xml

getDevice

Device getDevice(id)

Gets a device.

Example

// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");

// Configure HTTP basic authorization: user
HttpBasicAuth user = (HttpBasicAuth) defaultClient.getAuthentication("user");
user.setUsername("YOUR USERNAME");
user.setPassword("YOUR PASSWORD");

DeviceApi apiInstance = new DeviceApi();
Long id = 789L; // Long | The device id.
try {
    Device result = apiInstance.getDevice(id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceApi#getDevice");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The device id.

Return type

Device

Authorization

admin, user

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/json, application/xml

getDeviceLocation

Location getDeviceLocation(id)

Gets the last device location.

Example

// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");

// Configure HTTP basic authorization: user
HttpBasicAuth user = (HttpBasicAuth) defaultClient.getAuthentication("user");
user.setUsername("YOUR USERNAME");
user.setPassword("YOUR PASSWORD");

DeviceApi apiInstance = new DeviceApi();
Long id = 789L; // Long | The device id.
try {
    Location result = apiInstance.getDeviceLocation(id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceApi#getDeviceLocation");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The device id.

Return type

Location

Authorization

admin, user

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/json, application/xml

getDeviceVisits

List<Visit> getDeviceVisits(id, start, duration)

Gets the last device location.

Example

// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");

// Configure HTTP basic authorization: user
HttpBasicAuth user = (HttpBasicAuth) defaultClient.getAuthentication("user");
user.setUsername("YOUR USERNAME");
user.setPassword("YOUR PASSWORD");

DeviceApi apiInstance = new DeviceApi();
Long id = 789L; // Long | The device id.
Long start = 789L; // Long | The start time in Epoch milliseconds.
Long duration = 789L; // Long | The duration in milliseconds.
try {
    List<Visit> result = apiInstance.getDeviceVisits(id, start, duration);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceApi#getDeviceVisits");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The device id.
start Long The start time in Epoch milliseconds.
duration Long The duration in milliseconds.

Return type

List<Visit>

Authorization

admin, user

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/json, application/xml

getDevices

DevicePage getDevices(pageOffset, pageSize)

Returns all devices.

Example

// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");

DeviceApi apiInstance = new DeviceApi();
Integer pageOffset = 0; // Integer | The offset in terms of elements.
Integer pageSize = 20; // Integer | The maximum number of elements on the page.
try {
    DevicePage result = apiInstance.getDevices(pageOffset, pageSize);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceApi#getDevices");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
pageOffset Integer The offset in terms of elements. [optional] [default to 0]
pageSize Integer The maximum number of elements on the page. [optional] [default to 20]

Return type

DevicePage

Authorization

admin

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/json, application/xml

setDevice

Device setDevice(id, body)

Sets the values of a device.

Example

// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");

DeviceApi apiInstance = new DeviceApi();
Long id = 789L; // Long | The device id.
Device body = new Device(); // Device | The device values.
try {
    Device result = apiInstance.setDevice(id, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceApi#setDevice");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The device id.
body Device The device values. [optional]

Return type

Device

Authorization

admin

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/json, application/xml