Skip to content

IoT File Client for Java

Introduction

The IoT File Java client allows you to manage files related to assets. Refer to IoT File Service for more information about the service.

Hint

In the IoT context, assets are referred to as entity and aspects as propertyset.

File Operations

Client name: FileservicesClient

Create a File

Create a file for the specified entity and path with the provided content.

FileservicesClient fileservicesClient = FileservicesClient.builder()
                                            .mindsphereCredentials(credentials)
                                            .restClientConfig(config)
                                            .build();

FileWriterResponse fileWriterResponse;
try {
    fileWriterResponse = fileservicesClient.createFile(file,entityId,filepath,description,type);
} catch (MindsphereException e) {
    // Exception handling
}

Update a File

Update a file for the specified entity and path with the provided content.

//Construct FileservicesClient object as shown above

FileWriterResponse fileWriterResponse;
try {
    fileWriterResponse = fileservicesClient.updateFile(file, entityId, filepath, description, type, ifMatch);
} catch (MindsphereException e) {
    // Exception handling
}

Read a File

Read a file for the specified entity and path. The GET method is used for the API call.

//Construct FileservicesClient object as shown above

FileReaderResponse fileReaderResponse;
try {
    fileReaderResponse = fileservicesClient.readFile(entityId, filepath, ifNoneMatch)
} catch (MindsphereException e) {
    // Exception handling
}

Delete a File

Delete a file for the specified entity and path.

//Construct FileservicesClient object as shown above

boolean isFileDeleted;
try {
    isFileDeleted = fileservicesClient.deleteFile(entityId, filepath)
} catch (MindsphereException e) {
    // Exception handling
}

Search a File

Search one or multiple files for the specified entity and path.

//Construct FileservicesClient object as shown above

FileSearchResponse fileSearchResponse;
try {
    fileSearchResponse = fileservicesClient.searchFiles(entityId, offset, limit, count, order, filter);
} catch (MindsphereException e) {
    // Exception handling
}

Last update: February 23, 2024

Except where otherwise noted, content on this site is licensed under the Development License Agreement.