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

ModelApi

Java SDK: the Model operations, 12 methods, each with its parameters, result and a complete example.

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

Calls related to models, for example to upload or download models

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

MethodOperationDescription
addModelWithUrlAddModelWithUrlAdd a new model by providing a URL
augmentBcfAugmentBcfAdd snapshots to a BCF
downloadDownloadDownload the model of the given Version UUID, as uploaded or as IFC or ifcXML.
downloadIfcXmlDownloadIfcXmlDownload the model of the given Version UUID serialized as ifcXML (deprecated, use Download with format ifcxml)
exportGeometryExportGeometryThe geometry of models as glTF
exportVectorSvgExportVectorSvgExport an orthographic vector drawing (SVG) of a model
getCheckinGetCheckinThe status of a checkin
getValidationReportGetValidationReportWhy a model is invalid, or why its checkin failed
lookupModelHashesLookupModelHashesWhich files the server has already
renderRenderA PNG image of a model
schemaConversionReportSchemaConversionReportThe log of a schema conversion
uploadModelUploadModelUpload a single model using multipart/form-data

addModelWithUrl#

Java#
public ModelVersion addModelWithUrl(AddModelWithUrlRequest addModelWithUrlRequest) throws ApiException

Add a new model by providing a URL. The server fetches the file from url (within its egress policy) and checks it in under node_uuid. The checkin (parsing, geometry, indexing) follows the upload, which is always waited for. Without wait_ms the call answers when the checkin ends, with the new Version, which for a big model can take longer than a gateway waits. With wait_ms it answers the Version when the checkin ends within that many milliseconds, and otherwise 202 with the checkin's status and job_uuid: follow it with GetCheckin. A checkin still running after an hour answers 202 too. A ZIP of models is checked in where it was received and has no job, so it always waits. The same file name in the same folder adds a Version to that model.

OperationAddModelWithUrl · POST /openapi/model/AddModelWithUrl
Scopemodel:upload

Parameters#

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

Returns#

ModelVersion — Upload was successful

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.ModelApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.AddModelWithUrlRequest;
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
        AddModelWithUrlRequest request = client.getObjectMapper().readValue("""
                {
                  "node_uuid": "00000000-0000-0000-0000-000000000000",
                  "path": "",
                  "filename": "",
                  "url": "",
                  "input_file_type": "IFC",
                  "format_settings": {},
                  "force_reprocessing": false,
                  "tags": [
                    "DEMO"
                  ],
                  "validation_settings": {},
                  "wait_ms": 0,
                  "force": "NONE"
                }
                """, AddModelWithUrlRequest.class);

        // 3. The call
        var result = new ModelApi(client).addModelWithUrl(request);

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

augmentBcf#

Java#
public File augmentBcf(File bcf, UUID versionUuid, Integer width, Integer height) throws ApiException

Add snapshots to a BCF. Answers the BCF 2.1 file with a PNG snapshot rendered for each viewpoint that has a perspective camera, of the model version_uuid: an integrator keeps its issues and gets BCF with images out of them. Orthogonal viewpoints keep what they had; at most 1000 snapshots are rendered per file.

OperationAugmentBcf · POST /openapi/model/AugmentBcf
Scopegeometry:read

Parameters#

NameTypeDescription
bcfFilerequiredThe file. The BCF 2.1 file
versionUuidUUIDrequired
widthIntegeroptionalThe snapshots' width in pixels, 300 when absent
heightIntegeroptionalThe snapshots' height in pixels, 300 when absent

Returns#

File — The BCF with the snapshots

Example#

Java#
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.UUID;
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.ModelApi;
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
        File bcf = new File("issues.bcf");
        UUID versionUuid = UUID.fromString("<version uuid of the first demo model>");

        // 3. The call
        var result = new ModelApi(client).augmentBcf(bcf, versionUuid, null, null);

        // 4. The result
        Files.move(result.toPath(), Path.of("augment-bcf.bcf"), StandardCopyOption.REPLACE_EXISTING);
    }
}

download#

Java#
public File download(DownloadRequest downloadRequest) throws ApiException

Download the model of the given Version UUID, as uploaded or as IFC or ifcXML. In case you want to download only a subset of an IFC model, use ifc/query. format chooses what comes back; it wins over the Accept header, which is not read by this operation. original (the default) is the file as it was uploaded, byte for byte; ifc and ifcxml serialize the stored model, so they work for any Version whose model parsed as IFC, whatever its upload encoding. With error_uuid instead of a model identifier the file of a failed upload comes back as it was uploaded.

OperationDownload · POST /openapi/model/Download
Scopemodel:read

Parameters#

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

Returns#

File — The model file. Without target_schema byte-for-byte as it was uploaded, with target_schema the converted 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.ModelApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.DownloadRequest;
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
        DownloadRequest request = client.getObjectMapper().readValue("""
                {
                  "type": "VersionModelIdentifier",
                  "uuid": "<version uuid of the first demo model>"
                }
                """, DownloadRequest.class);

        // 3. The call
        var result = new ModelApi(client).download(request);

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

downloadIfcXml#

Java#
public File downloadIfcXml(ModelIdentifier modelIdentifier) throws ApiException

Download the model of the given Version UUID serialized as ifcXML (deprecated, use Download with format ifcxml). Deprecated, Download with format ifcxml answers the same file; this operation will be removed in a later release. The stored model is converted on the fly, so this works for any Version whose model parsed as IFC, regardless of the encoding it was uploaded in. The ifcXML dialect follows the model's schema, ISO 10303-28 for IFC2X3 and ifcXML4 for IFC4/IFC4X3.

OperationDownloadIfcXml · POST /openapi/model/DownloadIfcXml
Scopemodel:read

Parameters#

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

Returns#

File — The model serialized as ifcXML

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.ModelApi;
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.ModelIdentifier;

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
        ModelIdentifier request = client.getObjectMapper().readValue("""
                {
                  "type": "VersionModelIdentifier",
                  "uuid": "<version uuid of the first demo model>"
                }
                """, ModelIdentifier.class);

        // 3. The call
        var result = new ModelApi(client).downloadIfcXml(request);

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

exportGeometry#

Java#
public File exportGeometry(ExportGeometryRequest exportGeometryRequest) throws ApiException

The geometry of models as glTF. Exports the triangulated geometry of the objects a BQL condition selects (every product when absent) as one binary glTF file, several models in one file.

OperationExportGeometry · POST /openapi/model/ExportGeometry
Scopegeometry:read

Parameters#

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

Returns#

File — The 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.ModelApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.ExportGeometryRequest;
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
        ExportGeometryRequest request = client.getObjectMapper().readValue("""
                {
                  "models": [
                    {
                      "type": "UrlModelIdentifier"
                    }
                  ],
                  "query": "",
                  "format": "glb",
                  "colors": {},
                  "only_outside_triangles": false
                }
                """, ExportGeometryRequest.class);

        // 3. The call
        var result = new ModelApi(client).exportGeometry(request);

        // 4. The result
        Files.move(result.toPath(), Path.of("export-geometry.glb"), StandardCopyOption.REPLACE_EXISTING);
    }
}

exportVectorSvg#

Java#
public File exportVectorSvg(ExportVectorSvgRequest exportVectorSvgRequest) throws ApiException

Export an orthographic vector drawing (SVG) of a model. Renders a floor plan, section or elevation of one model as an SVG drawing with occlusion culling (every product its own group), optionally restricted, recoloured and labelled through BQL and BVL. A request carrying styling also needs the actions:read scope. The response carries the drawing; the cache and labels objects of the task response are returned as the X-BimWorks-Vector header (JSON).

OperationExportVectorSvg · POST /openapi/model/ExportVectorSvg
Scopegeometry:read

Parameters#

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

Returns#

File — The drawing

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.ModelApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.ExportVectorSvgRequest;
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
        ExportVectorSvgRequest request = client.getObjectMapper().readValue("""
                {}
                """, ExportVectorSvgRequest.class);

        // 3. The call
        var result = new ModelApi(client).exportVectorSvg(request);

        // 4. The result
        Files.move(result.toPath(), Path.of("export-vector-svg.svg"), StandardCopyOption.REPLACE_EXISTING);
    }
}

getCheckin#

Java#
public CheckinStatus getCheckin(GetCheckinRequest getCheckinRequest) throws ApiException

The status of a checkin. The status of the checkin of an upload, by the job_uuid an upload answered with 202, or by the version_uuid it made. With wait_ms the call waits that long for the checkin to end (at most 5 minutes). Once it is DONE the answer holds the Version; once it FAILED, the error. Needs read rights on the model. Checkin jobs are kept for 30 days.

OperationGetCheckin · POST /openapi/model/GetCheckin
Scopefs:read

Parameters#

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

Returns#

CheckinStatus — The status

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.ModelApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.GetCheckinRequest;
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
        GetCheckinRequest request = client.getObjectMapper().readValue("""
                {
                  "job_uuid": "00000000-0000-0000-0000-000000000000",
                  "version_uuid": "<version uuid of the first demo model>",
                  "wait_ms": 0
                }
                """, GetCheckinRequest.class);

        // 3. The call
        var result = new ModelApi(client).getCheckin(request);

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

getValidationReport#

Java#
public ValidationReportResult getValidationReport(GetValidationReportRequest getValidationReportRequest) throws ApiException

Why a model is invalid, or why its checkin failed. The validation report of a Version (model) or of a failed checkin (error_uuid, from ListNodeErrors): per stage of the checkin (upload, parse, schemaCheck, geometry3d, geometry2d, indexing, ...) its status and its findings, each with its rule, severity and the object it is about. summary_only answers the counts.

OperationGetValidationReport · POST /openapi/model/GetValidationReport
Scopequery:run

Parameters#

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

Returns#

ValidationReportResult — The report

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.ModelApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.GetValidationReportRequest;
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
        GetValidationReportRequest request = client.getObjectMapper().readValue("""
                {
                  "model": {
                    "type": "UrlModelIdentifier"
                  },
                  "error_uuid": "00000000-0000-0000-0000-000000000000",
                  "summary_only": false,
                  "min_severity": "INFO",
                  "stage": "",
                  "rule": [
                    ""
                  ],
                  "global_id": "",
                  "express_id": 0
                }
                """, GetValidationReportRequest.class);

        // 3. The call
        var result = new ModelApi(client).getValidationReport(request);

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

lookupModelHashes#

Java#
public LookupModelHashes200Response lookupModelHashes(LookupModelHashesRequest lookupModelHashesRequest) throws ApiException

Which files the server has already. For each file, whether the server has processed one with the same content, so its upload can send the hash instead of the bytes (UploadModel). Hash the first 32 KiB and pass that with the size first, which is cheap; for the files that are known, hash the whole file and pass full_xxh64. The answer is in the order asked. max_concurrent_checkins is how many checkins the answering server runs at once: an upload scheduler keeps about that many uploads going.

OperationLookupModelHashes · POST /openapi/model/LookupModelHashes
Scopemodel:upload

Parameters#

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

Returns#

LookupModelHashes200Response — Per file whether it is known

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.ModelApi;
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.LookupModelHashesRequest;

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
        LookupModelHashesRequest request = client.getObjectMapper().readValue("""
                {
                  "models": [
                    {
                      "size": 1048576,
                      "partial_xxh64": 12345678901234567890
                    }
                  ]
                }
                """, LookupModelHashesRequest.class);

        // 3. The call
        var result = new ModelApi(client).lookupModelHashes(request);

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

render#

Java#
public File render(RenderRequest renderRequest) throws ApiException

A PNG image of a model. Renders one model as a PNG. With camera it shows that view; with view one of the named angles, framing the whole model. With neither it answers the screenshot the checkin stored, or else the iso_front_right view. A workspace whose filter limits the objects gets no image of the whole model. Rendering must be enabled on the instance; a host without a GPU renders on the CPU.

OperationRender · POST /openapi/model/Render
Scopegeometry:read

Parameters#

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

Returns#

File — The image

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.ModelApi;
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.RenderRequest;

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
        RenderRequest request = client.getObjectMapper().readValue("""
                {
                  "model": {
                    "type": "UrlModelIdentifier"
                  },
                  "camera": {
                    "position": {
                      "x": 0.0,
                      "y": 0.0,
                      "z": 0.0
                    }
                  },
                  "view": "iso_front_right",
                  "size": {}
                }
                """, RenderRequest.class);

        // 3. The call
        var result = new ModelApi(client).render(request);

        // 4. The result
        Files.move(result.toPath(), Path.of("render.png"), StandardCopyOption.REPLACE_EXISTING);
    }
}

schemaConversionReport#

Java#
public SchemaConversionReportResponse schemaConversionReport(SchemaConversionReportRequest schemaConversionReportRequest) throws ApiException

The log of a schema conversion. What a schema conversion lost, added and changed. For a Version that was made by the statement CONVERT SCHEMA pass its identifier; for a converted download pass the identifier of the Version that was downloaded and the target_schema it was converted to. This call reads a log, it converts nothing; a conversion that was never made is not found. The report holds the summary, exact counters per rule and a capped number of findings per rule. Every single loss and addition is in the detail log, which is never capped.

OperationSchemaConversionReport · POST /openapi/model/SchemaConversionReport
Scopemodel:read

Parameters#

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

Returns#

SchemaConversionReportResponse — The conversion report in the requested format

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.ModelApi;
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.SchemaConversionReportRequest;

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
        SchemaConversionReportRequest request = client.getObjectMapper().readValue("""
                {
                  "type": "VersionModelIdentifier",
                  "uuid": "<version uuid of the first demo model>",
                  "target_schema": "IFC4"
                }
                """, SchemaConversionReportRequest.class);

        // 3. The call
        var result = new ModelApi(client).schemaConversionReport(request);

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

uploadModel#

Java#
public ModelVersion uploadModel(File _file, UUID nodeUuid, String filename, Long filesize, String contentType, String inputFileType, String formatSettings, String hash, Boolean forceReprocessing, String tags, String validationSettings, Long waitMs, String force) throws ApiException

Upload a single model using multipart/form-data. Uploads a file into the folder node_uuid (the caller's own root when absent). When LookupModelHashes says the server has the file already, send its hash instead of the file part: no bytes travel. A hash the server cannot use after all answers NO_STREAM (404); send the file then. The checkin (parsing, geometry, indexing) follows the upload, which is always waited for. Without wait_ms the call answers when the checkin ends, with the new Version, which for a big model can take longer than a gateway waits. With wait_ms it answers the Version when the checkin ends within that many milliseconds, and otherwise 202 with the checkin's status and job_uuid: follow it with GetCheckin. A checkin still running after an hour answers 202 too. A ZIP of models is checked in where it was received and has no job, so it always waits. The same file name in the same folder adds a Version to that model.

OperationUploadModel · POST /openapi/model/UploadModel
Scopemodel:upload

Parameters#

NameTypeDescription
_fileFileoptionalThe file. A single uploaded model
nodeUuidUUIDoptionalThe UUID of the Node to which to add the models
filenameStringoptionalName of the file
filesizeLongoptionalFilesize in bytes
contentTypeStringoptionalThe content type. When available this information is taken from the Content-Type of the file part. Allowed values are application/ifc, application/xml (for .ifcxml files), application/pdf, application/e57
inputFileTypeStringoptionalThe type of the model (an InputFileType name). When present and not UNKNOWN it wins over the filename extension
formatSettingsStringoptionalA JSON-encoded PointCloudFormatSettings object (multipart form fields are strings) with per-upload point cloud format options
hashStringoptionalInstead of the file, its full_xxh64 (see ModelHash) when LookupModelHashes said the server knows it; ignored next to a file, which the server hashes itself. Needs filename
forceReprocessingBooleanoptionalProcess the file again, also when the server has processed the same file before
tagsStringoptionalTags of the new Version, comma-separated VersionTag names
validationSettingsStringoptionalA JSON-encoded ValidationSettings object
waitMsLongoptionalAnswer 202 with the checkin's status when the checkin takes longer than this
forceStringoptionalAn UploadForce: NONE, NEW_VERSION or NEW_MODEL

Returns#

ModelVersion — Upload was successful

Example#

Java#
import java.io.File;
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.ModelApi;
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
        File _file = new File("model.ifc");
        String filename = "model.ifc";

        // 3. The call
        var result = new ModelApi(client).uploadModel(_file, null, filename, null, null, null, null, null, null, null, null, null, null);

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