Skip to content

lab5e/java-spanapi

Repository files navigation

span-java-client

The Span API

  • API version: 4.4.2 nonviolent-adelbert
    • Build date: 2023-03-02T10:55:33.745521Z[Etc/UTC]

API for device, collection, output and firmware management

For more information, please visit https://lab5e.com

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven (3.8.3+)/Gradle (7.2+)

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.lab5e</groupId>
  <artifactId>span-java-client</artifactId>
  <version>4.4.2</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

  repositories {
    mavenCentral()     // Needed if the 'span-java-client' jar has been published to maven central.
    mavenLocal()       // Needed if the 'span-java-client' jar has been published to the local maven repo.
  }

  dependencies {
     implementation "com.lab5e:span-java-client:4.4.2"
  }

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/span-java-client-4.4.2.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

// Import classes:
import com.lab5e.ApiClient;
import com.lab5e.ApiException;
import com.lab5e.Configuration;
import com.lab5e.auth.*;
import com.lab5e.models.*;
import com.lab5e.span.BlobsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.lab5e.com");
    
    // Configure API key authorization: APIToken
    ApiKeyAuth APIToken = (ApiKeyAuth) defaultClient.getAuthentication("APIToken");
    APIToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIToken.setApiKeyPrefix("Token");

    BlobsApi apiInstance = new BlobsApi(defaultClient);
    String collectionId = "collectionId_example"; // String | 
    String blobId = "blobId_example"; // String | 
    try {
      Object result = apiInstance.deleteBlob(collectionId, blobId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling BlobsApi#deleteBlob");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Documentation for API Endpoints

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

Class Method HTTP request Description
BlobsApi deleteBlob DELETE /span/collections/{collectionId}/blobs/{blobId} Remove a blob stored on a collection
BlobsApi listBlobs GET /span/collections/{collectionId}/blobs List the blobs for a collection
CertificatesApi createCertificate POST /span/collections/{collectionId}/certificates/create Create certificate
CertificatesApi retrieveCertificateChain GET /span/collections/{collectionId}/certificates Get certificate chain
CertificatesApi signCertificate POST /span/collections/{collectionId}/certificates/sign Sign certificate
CertificatesApi verifyCertificate POST /span/collections/{collectionId}/certificates/verify Verify certificate
CollectionsApi createCollection POST /span/collections Create collection
CollectionsApi deleteCollection DELETE /span/collections/{collectionId} Delete collection
CollectionsApi listCollectionData GET /span/collections/{collectionId}/data Retrieve data from devices
CollectionsApi listCollections GET /span/collections List collections
CollectionsApi retrieveCollection GET /span/collections/{collectionId} Retrieve collection
CollectionsApi updateCollection PATCH /span/collections/{collectionId} Update collection
DevicesApi addDownstreamMessage POST /span/collections/{collectionId}/devices/{deviceId}/outbox Add message to oubox
DevicesApi createDevice POST /span/collections/{collectionId}/devices Create device
DevicesApi deleteDevice DELETE /span/collections/{collectionId}/devices/{deviceId} Remove device.
DevicesApi deleteDownstreamMessage DELETE /span/collections/{collectionId}/devices/{deviceId}/outbox/{messageId} Delete outgoing message
DevicesApi deviceCertificate GET /span/collections/{collectionId}/devices/{deviceId}/certs Get issued certificate(s) for device
DevicesApi listDeviceData GET /span/collections/{collectionId}/devices/{deviceId}/data Retrieve data from device
DevicesApi listDevices GET /span/collections/{collectionId}/devices List devices in collection.
DevicesApi listDownstreamMessages GET /span/collections/{collectionId}/devices/{deviceId}/outbox List the messages in the outbox
DevicesApi listUpstreamMessages GET /span/collections/{collectionId}/devices/{deviceId}/inbox List incoming messages
DevicesApi retrieveDevice GET /span/collections/{collectionId}/devices/{deviceId} Retrieve device
DevicesApi updateDevice PATCH /span/collections/{existingCollectionId}/devices/{deviceId} Update device
FotaApi clearFirmwareError DELETE /span/collections/{collectionId}/devices/{deviceId}/fwerror Clear FOTA error
FotaApi createFirmware POST /span/collections/{collectionId}/firmware Create firmware
FotaApi deleteFirmware DELETE /span/collections/{collectionId}/firmware/{imageId} Delete firmware
FotaApi firmwareUsage GET /span/collections/{collectionId}/firmware/{imageId}/usage Firmware usage
FotaApi listFirmware GET /span/collections/{collectionId}/firmware List firmware
FotaApi retrieveFirmware GET /span/collections/{collectionId}/firmware/{imageId} Retrieve firmware
FotaApi updateFirmware PATCH /span/collections/{existingCollectionId}/firmware/{imageId} Update firmware
GatewaysApi createGateway POST /span/collections/{collectionId}/gateways Create gateway
GatewaysApi deleteGateway DELETE /span/collections/{collectionId}/gateways/{gatewayId} Delete gateway
GatewaysApi gatewayCertificates GET /span/collections/{collectionId}/gateways/{gatewayId}/certs Get issued certificate(s) for gateway
GatewaysApi listGateways GET /span/collections/{collectionId}/gateways List gateways
GatewaysApi retrieveGateway GET /span/collections/{collectionId}/gateways/{gatewayId} Retrieve gateway
GatewaysApi updateGateway PATCH /span/collections/{existingCollectionId}/gateways/{gatewayId} Update gateway
OutputsApi createOutput POST /span/collections/{collectionId}/outputs Create output
OutputsApi deleteOutput DELETE /span/collections/{collectionId}/outputs/{outputId} Delete output
OutputsApi listOutputs GET /span/collections/{collectionId}/outputs List outputs
OutputsApi logs GET /span/collections/{collectionId}/outputs/{outputId}/logs Output logs
OutputsApi retrieveOutput GET /span/collections/{collectionId}/outputs/{outputId} Retrieve output
OutputsApi status GET /span/collections/{collectionId}/outputs/{outputId}/status Output status
OutputsApi updateOutput PATCH /span/collections/{existingCollectionId}/outputs/{outputId} Update output
SpanApi getSystemInfo GET /span/system System information

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

APIToken

  • Type: API key
  • API key parameter name: X-API-Token
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

dev@lab5e.com