Reference·Java SDK · nl.bimbase.bimworks.sdkJava

FsApi

Java SDK: the Fs - FileSystem operations, 16 methods, each with its parameters, result and a complete example.

Java SDK · nl.bimbase.bimworks.sdk.api · class · 16 methods

BIM.works repository's virtual filesystem related calls.

Construct it with the client of the connect step: new FsApi(client). Each method is one operation of the API part, where it runs on its page.

MethodOperationDescription
createNodeCreateNodeCreate a new Node
deleteNodeDeleteNodeDelete a Node
deleteNodeErrorDeleteNodeErrorClear an error of a Node
deleteVersionDeleteVersionDelete a Version of a Node
downloadAsZipDownloadAsZipDownload a folder Node and everything below it as a ZIP file
getNodeGetNodeGet Node based on a given path, by its UUID or by the UUID of one of its Versions.
getRootNodeUuidGetRootNodeUuidGet the UUID of the current root Node.
getVersionGetVersionGet a Version by its UUID
listNodeErrorsListNodeErrorsGet the errors of the given Node
listNodesListNodesGet a list of Nodes that are children of the given Node
listNodesRecursiveListNodesRecursiveGet all Nodes below the given Node, recursively
listVersionsListVersionsGet a list of all the Versions of the given Node, or the given Versions
moveNodeMoveNodeMove a Node to another parent folder
undeleteNodeUndeleteNodeRestore a previously deleted Node
updateNodeUpdateNodeUpdate a Node
updateVersionUpdateVersionChange a Version's disciplines or alignment

createNode#

Java#
public Node createNode(CreateNodeRequest createNodeRequest) throws ApiException

Create a new Node.

OperationCreateNode · POST /openapi/fs/CreateNode
Scopefs:write

Parameters#

NameTypeDescription
createNodeRequestCreateNodeRequestrequiredThe request: its properties are those of the model, its JSON that of CreateNode's request body.

Returns#

Node — The new Node

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.CreateNodeRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        CreateNodeRequest request = client.getObjectMapper().readValue("""
                {
                  "name": "",
                  "folder": false,
                  "input_file_type": "IFC",
                  "parent_node_uuid": "00000000-0000-0000-0000-000000000000",
                  "allow_existing": false
                }
                """, CreateNodeRequest.class);

        // 3. The call
        var result = new FsApi(client).createNode(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

deleteNode#

Java#
public void deleteNode(DeleteNodeRequest deleteNodeRequest) throws ApiException

Delete a Node. Deletes the given Node, named by uuid or by path. This is a soft delete, a deleted Node can be restored with UndeleteNode. The Root Node of the current token cannot be deleted. With if_exists a Node that does not exist is no error.

OperationDeleteNode · POST /openapi/fs/DeleteNode
Scopefs:write

Parameters#

NameTypeDescription
deleteNodeRequestDeleteNodeRequestrequiredThe request: its properties are those of the model, its JSON that of DeleteNode's request body.

Returns#

Nothing: the operation answers without a body (The Node was deleted).

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.DeleteNodeRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        DeleteNodeRequest request = client.getObjectMapper().readValue("""
                {
                  "uuid": "<version uuid of the first demo model>"
                }
                """, DeleteNodeRequest.class);

        // 3. The call
        new FsApi(client).deleteNode(request);

        // 4. The result
        // (DeleteNode answers no content: the call returns once it succeeded and throws an ApiException otherwise)
        System.out.println("Done");
    }
}

deleteNodeError#

Java#
public void deleteNodeError(DeleteNodeErrorRequest deleteNodeErrorRequest) throws ApiException

Clear an error of a Node. Removes an error record (a failed upload or checkin, see ListNodeErrors) once its cause is dealt with. Needs write rights on the Node.

OperationDeleteNodeError · POST /openapi/fs/DeleteNodeError
Scopefs:write

Parameters#

NameTypeDescription
deleteNodeErrorRequestDeleteNodeErrorRequestrequiredThe request: its properties are those of the model, its JSON that of DeleteNodeError's request body.

Returns#

Nothing: the operation answers without a body (The error is cleared).

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.DeleteNodeErrorRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        DeleteNodeErrorRequest request = client.getObjectMapper().readValue("""
                {
                  "node_uuid": "00000000-0000-0000-0000-000000000000",
                  "error_uuid": "00000000-0000-0000-0000-000000000000"
                }
                """, DeleteNodeErrorRequest.class);

        // 3. The call
        new FsApi(client).deleteNodeError(request);

        // 4. The result
        // (DeleteNodeError answers no content: the call returns once it succeeded and throws an ApiException otherwise)
        System.out.println("Done");
    }
}

deleteVersion#

Java#
public void deleteVersion(DeleteVersionRequest deleteVersionRequest) throws ApiException

Delete a Version of a Node. Only the last Version of a Node can be deleted, intermediate Versions must stay available.

OperationDeleteVersion · POST /openapi/fs/DeleteVersion
Scopefs:write

Parameters#

NameTypeDescription
deleteVersionRequestDeleteVersionRequestrequiredThe request: its properties are those of the model, its JSON that of DeleteVersion's request body.

Returns#

Nothing: the operation answers without a body (The Version was deleted).

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.DeleteVersionRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        DeleteVersionRequest request = client.getObjectMapper().readValue("""
                {
                  "node_uuid": "00000000-0000-0000-0000-000000000000",
                  "version_uuid": "<version uuid of the first demo model>"
                }
                """, DeleteVersionRequest.class);

        // 3. The call
        new FsApi(client).deleteVersion(request);

        // 4. The result
        // (DeleteVersion answers no content: the call returns once it succeeded and throws an ApiException otherwise)
        System.out.println("Done");
    }
}

downloadAsZip#

Java#
public File downloadAsZip(DownloadAsZipRequest downloadAsZipRequest) throws ApiException

Download a folder Node and everything below it as a ZIP file. The ZIP file contains the original model files of the last Version of every Node below the given folder Node, with their tree paths as ZIP entry paths. With format ZIP_ZST the same ZIP comes compressed as a whole with zstd, a .zip.zst file.

OperationDownloadAsZip · POST /openapi/fs/DownloadAsZip
Scopemodel:read

Parameters#

NameTypeDescription
downloadAsZipRequestDownloadAsZipRequestrequiredThe request: its properties are those of the model, its JSON that of DownloadAsZip's request body.

Returns#

File — The ZIP file, or with format ZIP_ZST the zstd-compressed ZIP file

Example#

Java#
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.DownloadAsZipRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        DownloadAsZipRequest request = client.getObjectMapper().readValue("""
                {
                  "uuid": "<version uuid of the first demo model>",
                  "include_deleted": false,
                  "format": "ZIP"
                }
                """, DownloadAsZipRequest.class);

        // 3. The call
        var result = new FsApi(client).downloadAsZip(request);

        // 4. The result
        Files.move(result.toPath(), Path.of("download-as-zip.zip"), StandardCopyOption.REPLACE_EXISTING);
    }
}

getNode#

Java#
public Node getNode(GetNodeRequest getNodeRequest) throws ApiException

Get Node based on a given path, by its UUID or by the UUID of one of its Versions. A path is always relative to the Root Node of the used Token.

OperationGetNode · POST /openapi/fs/GetNode
Scopefs:read

Parameters#

NameTypeDescription
getNodeRequestGetNodeRequestrequiredThe request: its properties are those of the model, its JSON that of GetNode's request body.

Returns#

Node — All information of the Node on this path

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.GetNodeRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        GetNodeRequest request = client.getObjectMapper().readValue("""
                {
                  "path": "",
                  "uuid": "<version uuid of the first demo model>",
                  "version_uuid": "<version uuid of the first demo model>"
                }
                """, GetNodeRequest.class);

        // 3. The call
        var result = new FsApi(client).getNode(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

getRootNodeUuid#

Java#
public UUID getRootNodeUuid() throws ApiException

Get the UUID of the current root Node. This depends on the API Token/Auth Token that is being used.

OperationGetRootNodeUuid · GET /openapi/fs/GetRootNodeUuid
Scopefs:read

Parameters#

None: the operation takes no request.

Returns#

UUID — The UUID of the Root Node

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        // (GetRootNodeUuid takes no request)

        // 3. The call
        var result = new FsApi(client).getRootNodeUuid();

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

getVersion#

Java#
public ModelVersion getVersion(GetVersionRequest getVersionRequest) throws ApiException

Get a Version by its UUID.

OperationGetVersion · POST /openapi/fs/GetVersion
Scopefs:read

Parameters#

NameTypeDescription
getVersionRequestGetVersionRequestrequiredThe request: its properties are those of the model, its JSON that of GetVersion's request body.

Returns#

ModelVersion — Version information

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.GetVersionRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        GetVersionRequest request = client.getObjectMapper().readValue("""
                {
                  "uuid": "<version uuid of the first demo model>"
                }
                """, GetVersionRequest.class);

        // 3. The call
        var result = new FsApi(client).getVersion(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

listNodeErrors#

Java#
public List<ModelError> listNodeErrors(ListNodeErrorsRequest listNodeErrorsRequest) throws ApiException

Get the errors of the given Node. Model uploads are processed asynchronously. When processing fails, the resulting errors can be retrieved with this call. Errors are sorted oldest first.

OperationListNodeErrors · POST /openapi/fs/ListNodeErrors
Scopefs:read

Parameters#

NameTypeDescription
listNodeErrorsRequestListNodeErrorsRequestrequiredThe request: its properties are those of the model, its JSON that of ListNodeErrors's request body.

Returns#

List<ModelError> — The errors of the given Node

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.ListNodeErrorsRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        ListNodeErrorsRequest request = client.getObjectMapper().readValue("""
                {
                  "uuid": "<version uuid of the first demo model>"
                }
                """, ListNodeErrorsRequest.class);

        // 3. The call
        var result = new FsApi(client).listNodeErrors(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

listNodes#

Java#
public List<Node> listNodes(ListNodesRequest listNodesRequest) throws ApiException

Get a list of Nodes that are children of the given Node.

OperationListNodes · POST /openapi/fs/ListNodes
Scopefs:read

Parameters#

NameTypeDescription
listNodesRequestListNodesRequestrequiredThe request: its properties are those of the model, its JSON that of ListNodes's request body.

Returns#

List<Node> — All information of the sub Nodes of the provided Node

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.ListNodesRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        ListNodesRequest request = client.getObjectMapper().readValue("""
                {
                  "path": "",
                  "uuid": "<version uuid of the first demo model>",
                  "version_uuid": "<version uuid of the first demo model>",
                  "show_deleted_nodes": false
                }
                """, ListNodesRequest.class);

        // 3. The call
        var result = new FsApi(client).listNodes(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

listNodesRecursive#

Java#
public List<Node> listNodesRecursive(ListNodesRecursiveRequest listNodesRecursiveRequest) throws ApiException

Get all Nodes below the given Node, recursively. Returns the given Node and all Nodes below it. Use caution on large trees, there is no pagination.

OperationListNodesRecursive · POST /openapi/fs/ListNodesRecursive
Scopefs:read

Parameters#

NameTypeDescription
listNodesRecursiveRequestListNodesRecursiveRequestrequiredThe request: its properties are those of the model, its JSON that of ListNodesRecursive's request body.

Returns#

List<Node> — The Node and all Nodes below it

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.ListNodesRecursiveRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        ListNodesRecursiveRequest request = client.getObjectMapper().readValue("""
                {
                  "uuid": "<version uuid of the first demo model>"
                }
                """, ListNodesRecursiveRequest.class);

        // 3. The call
        var result = new FsApi(client).listNodesRecursive(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

listVersions#

Java#
public List<ModelVersion> listVersions(ListVersionsRequest listVersionsRequest) throws ApiException

Get a list of all the Versions of the given Node, or the given Versions. Name the Node with one of path, uuid and version_uuid (a Version of the Node), or pass version_uuids to get those Versions, which may belong to different Nodes. Each Version needs read rights.

OperationListVersions · POST /openapi/fs/ListVersions
Scopefs:read

Parameters#

NameTypeDescription
listVersionsRequestListVersionsRequestrequiredThe request: its properties are those of the model, its JSON that of ListVersions's request body.

Returns#

List<ModelVersion> — All information of the Versions of the given Node, or of the given Versions

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.ListVersionsRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        ListVersionsRequest request = client.getObjectMapper().readValue("""
                {
                  "uuid": "<version uuid of the first demo model>"
                }
                """, ListVersionsRequest.class);

        // 3. The call
        var result = new FsApi(client).listVersions(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

moveNode#

Java#
public Node moveNode(MoveNodeRequest moveNodeRequest) throws ApiException

Move a Node to another parent folder. Moves the given Node under a new parent Node. The target Node must be a folder. Renaming is done with UpdateNode.

OperationMoveNode · POST /openapi/fs/MoveNode
Scopefs:write

Parameters#

NameTypeDescription
moveNodeRequestMoveNodeRequestrequiredThe request: its properties are those of the model, its JSON that of MoveNode's request body.

Returns#

Node — The moved Node

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.MoveNodeRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        MoveNodeRequest request = client.getObjectMapper().readValue("""
                {
                  "uuid": "<version uuid of the first demo model>",
                  "target_parent_uuid": "00000000-0000-0000-0000-000000000000"
                }
                """, MoveNodeRequest.class);

        // 3. The call
        var result = new FsApi(client).moveNode(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

undeleteNode#

Java#
public void undeleteNode(UndeleteNodeRequest undeleteNodeRequest) throws ApiException

Restore a previously deleted Node.

OperationUndeleteNode · POST /openapi/fs/UndeleteNode
Scopefs:write

Parameters#

NameTypeDescription
undeleteNodeRequestUndeleteNodeRequestrequiredThe request: its properties are those of the model, its JSON that of UndeleteNode's request body.

Returns#

Nothing: the operation answers without a body (The Node was restored).

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.UndeleteNodeRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        UndeleteNodeRequest request = client.getObjectMapper().readValue("""
                {
                  "uuid": "<version uuid of the first demo model>"
                }
                """, UndeleteNodeRequest.class);

        // 3. The call
        new FsApi(client).undeleteNode(request);

        // 4. The result
        // (UndeleteNode answers no content: the call returns once it succeeded and throws an ApiException otherwise)
        System.out.println("Done");
    }
}

updateNode#

Java#
public Node updateNode(UpdateNodeRequest updateNodeRequest) throws ApiException

Update a Node.

OperationUpdateNode · POST /openapi/fs/UpdateNode
Scopefs:write

Parameters#

NameTypeDescription
updateNodeRequestUpdateNodeRequestrequiredThe request: its properties are those of the model, its JSON that of UpdateNode's request body.

Returns#

Node — The updated Node

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.UpdateNodeRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        UpdateNodeRequest request = client.getObjectMapper().readValue("""
                {
                  "path": "",
                  "uuid": "<version uuid of the first demo model>",
                  "version_uuid": "<version uuid of the first demo model>",
                  "name": "",
                  "user_data": {}
                }
                """, UpdateNodeRequest.class);

        // 3. The call
        var result = new FsApi(client).updateNode(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

updateVersion#

Java#
public ModelVersion updateVersion(UpdateVersionRequest updateVersionRequest) throws ApiException

Change a Version's disciplines or alignment. Changes the fields that are passed in one transaction; the others stay as they are. disciplines: [] clears the disciplines, clear: [alignment] the alignment. Needs write rights on the Version.

OperationUpdateVersion · POST /openapi/fs/UpdateVersion
Scopemodel:write

Parameters#

NameTypeDescription
updateVersionRequestUpdateVersionRequestrequiredThe request: its properties are those of the model, its JSON that of UpdateVersion's request body.

Returns#

ModelVersion — The Version as it is now

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.FsApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.UpdateVersionRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        UpdateVersionRequest request = client.getObjectMapper().readValue("""
                {
                  "version_uuid": "<version uuid of the first demo model>",
                  "disciplines": [
                    "STRUCTURAL",
                    "ARCHITECTURAL"
                  ]
                }
                """, UpdateVersionRequest.class);

        // 3. The call
        var result = new FsApi(client).updateVersion(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}