Skip to content

Latest commit

 

History

History
359 lines (250 loc) · 12.9 KB

CollectionsApi.md

File metadata and controls

359 lines (250 loc) · 12.9 KB

spanapi.api.CollectionsApi

Load the API package

import 'package:spanapi/api.dart';

All URIs are relative to https://api.lab5e.com

Method HTTP request Description
createCollection POST /span/collections Create collection
deleteCollection DELETE /span/collections/{collectionId} Delete collection
listCollectionData GET /span/collections/{collectionId}/data Retrieve data from devices
listCollections GET /span/collections List collections
retrieveCollection GET /span/collections/{collectionId} Retrieve collection
retrieveCollectionStats GET /span/collections/{collectionId}/stats Retrieve collection statistics
updateCollection PATCH /span/collections/{collectionId} Update collection

createCollection

Collection createCollection(body)

Create collection

Create a new collection

Example

import 'package:spanapi/api.dart';
// TODO Configure API key authorization: APIToken
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKeyPrefix = 'Bearer';

final api_instance = CollectionsApi();
final body = CreateCollectionRequest(); // CreateCollectionRequest | Request object when creating a collection. The collect ID is assigned by the service.

try {
    final result = api_instance.createCollection(body);
    print(result);
} catch (e) {
    print('Exception when calling CollectionsApi->createCollection: $e\n');
}

Parameters

Name Type Description Notes
body CreateCollectionRequest Request object when creating a collection. The collect ID is assigned by the service.

Return type

Collection

Authorization

APIToken

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deleteCollection

Collection deleteCollection(collectionId)

Delete collection

Remove the collection. Devices, firmware images, outputs and all other related resources must be removed from the collection before it can be deleted.

Example

import 'package:spanapi/api.dart';
// TODO Configure API key authorization: APIToken
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKeyPrefix = 'Bearer';

final api_instance = CollectionsApi();
final collectionId = collectionId_example; // String | The ID of the collection you want to delete

try {
    final result = api_instance.deleteCollection(collectionId);
    print(result);
} catch (e) {
    print('Exception when calling CollectionsApi->deleteCollection: $e\n');
}

Parameters

Name Type Description Notes
collectionId String The ID of the collection you want to delete

Return type

Collection

Authorization

APIToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listCollectionData

ListDataResponse listCollectionData(collectionId, limit, start, end, offset)

Retrieve data from devices

Retrieve data sent by the devices in the collection. The maximum number of data points is 100.

Example

import 'package:spanapi/api.dart';
// TODO Configure API key authorization: APIToken
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKeyPrefix = 'Bearer';

final api_instance = CollectionsApi();
final collectionId = collectionId_example; // String | The collection ID requested. This is included in the request path.
final limit = 56; // int | Limit the number of payloads to return. The default is 512.
final start = start_example; // String | Start of time range. The default is 24 hours ago. Value is in milliseconds since epoch.
final end = end_example; // String | End of time range. The default is the current time stamp. Value is in milliseconds since epoch.
final offset = offset_example; // String | The message offset based on the message ID. This parameter can't be combined with the start and end parameters. If no parameter is set the first N messages will be returned. If this parameter is set the next N messages (from newest to oldest) with message ID less than the offset will be returned.

try {
    final result = api_instance.listCollectionData(collectionId, limit, start, end, offset);
    print(result);
} catch (e) {
    print('Exception when calling CollectionsApi->listCollectionData: $e\n');
}

Parameters

Name Type Description Notes
collectionId String The collection ID requested. This is included in the request path.
limit int Limit the number of payloads to return. The default is 512. [optional]
start String Start of time range. The default is 24 hours ago. Value is in milliseconds since epoch. [optional]
end String End of time range. The default is the current time stamp. Value is in milliseconds since epoch. [optional]
offset String The message offset based on the message ID. This parameter can't be combined with the start and end parameters. If no parameter is set the first N messages will be returned. If this parameter is set the next N messages (from newest to oldest) with message ID less than the offset will be returned. [optional]

Return type

ListDataResponse

Authorization

APIToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listCollections

ListCollectionResponse listCollections()

List collections

Lists all the collections that one of your teams owns. The collections returned includes only the data on the collection and not the summary information

Example

import 'package:spanapi/api.dart';
// TODO Configure API key authorization: APIToken
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKeyPrefix = 'Bearer';

final api_instance = CollectionsApi();

try {
    final result = api_instance.listCollections();
    print(result);
} catch (e) {
    print('Exception when calling CollectionsApi->listCollections: $e\n');
}

Parameters

This endpoint does not need any parameter.

Return type

ListCollectionResponse

Authorization

APIToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

retrieveCollection

Collection retrieveCollection(collectionId, upstream, downstream)

Retrieve collection

Retrieve collection information. This includes a list of the most recent messages in the inbox. The upstream and downstream parameters are optional and if set to true will include the timestamps for up to 100 messages up- and downstream for the last hour.

Example

import 'package:spanapi/api.dart';
// TODO Configure API key authorization: APIToken
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKeyPrefix = 'Bearer';

final api_instance = CollectionsApi();
final collectionId = collectionId_example; // String | The collection ID of the collection you are requesting
final upstream = true; // bool | 
final downstream = true; // bool | 

try {
    final result = api_instance.retrieveCollection(collectionId, upstream, downstream);
    print(result);
} catch (e) {
    print('Exception when calling CollectionsApi->retrieveCollection: $e\n');
}

Parameters

Name Type Description Notes
collectionId String The collection ID of the collection you are requesting
upstream bool [optional]
downstream bool [optional]

Return type

Collection

Authorization

APIToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

retrieveCollectionStats

CollectionStats retrieveCollectionStats(collectionId)

Retrieve collection statistics

Retrieve statistics for the collection. This is the aggregated metrics for devices, outputs, firmware images, blobs and gateways in the collection

Example

import 'package:spanapi/api.dart';
// TODO Configure API key authorization: APIToken
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKeyPrefix = 'Bearer';

final api_instance = CollectionsApi();
final collectionId = collectionId_example; // String | The collection ID of the collection you are requesting

try {
    final result = api_instance.retrieveCollectionStats(collectionId);
    print(result);
} catch (e) {
    print('Exception when calling CollectionsApi->retrieveCollectionStats: $e\n');
}

Parameters

Name Type Description Notes
collectionId String The collection ID of the collection you are requesting

Return type

CollectionStats

Authorization

APIToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateCollection

Collection updateCollection(collectionId, body)

Update collection

Update a collection.

Example

import 'package:spanapi/api.dart';
// TODO Configure API key authorization: APIToken
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKeyPrefix = 'Bearer';

final api_instance = CollectionsApi();
final collectionId = collectionId_example; // String | The ID of the collection. This is assigned by the backend.
final body = UpdateCollectionBody(); // UpdateCollectionBody | 

try {
    final result = api_instance.updateCollection(collectionId, body);
    print(result);
} catch (e) {
    print('Exception when calling CollectionsApi->updateCollection: $e\n');
}

Parameters

Name Type Description Notes
collectionId String The ID of the collection. This is assigned by the backend.
body UpdateCollectionBody

Return type

Collection

Authorization

APIToken

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]