Reference·PHP SDK · BIMworksPHP

FsApi

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

PHP SDK · BIMworks\Api · class · 16 methods

BIM.works repository's virtual filesystem related calls.

Construct it with the client of the connect step: new FsApi(config: $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#

PHP#
public function createNode(CreateNodeRequest $create_node_request): Node

Create a new Node.

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

Parameters#

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

Returns#

Node — The new Node

Example#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\CreateNodeRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "name": "",
  "folder": false,
  "input_file_type": "IFC",
  "parent_node_uuid": "00000000-0000-0000-0000-000000000000",
  "allow_existing": false
}
JSON, CreateNodeRequest::class);

// 3. The call
$result = (new FsApi(config: $client))->createNode($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;

deleteNode#

PHP#
public function deleteNode(DeleteNodeRequest $delete_node_request): void

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
delete_node_requestDeleteNodeRequestrequiredThe 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#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\DeleteNodeRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "<version uuid of the first demo model>"
}
JSON, DeleteNodeRequest::class);

// 3. The call
(new FsApi(config: $client))->deleteNode($request);

// 4. The result
// (DeleteNode answers no content: the call returns once it succeeded and throws an ApiException otherwise)
echo 'Done', PHP_EOL;

deleteNodeError#

PHP#
public function deleteNodeError(DeleteNodeErrorRequest $delete_node_error_request): void

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
delete_node_error_requestDeleteNodeErrorRequestrequiredThe 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#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\DeleteNodeErrorRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "node_uuid": "00000000-0000-0000-0000-000000000000",
  "error_uuid": "00000000-0000-0000-0000-000000000000"
}
JSON, DeleteNodeErrorRequest::class);

// 3. The call
(new FsApi(config: $client))->deleteNodeError($request);

// 4. The result
// (DeleteNodeError answers no content: the call returns once it succeeded and throws an ApiException otherwise)
echo 'Done', PHP_EOL;

deleteVersion#

PHP#
public function deleteVersion(DeleteVersionRequest $delete_version_request): void

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
delete_version_requestDeleteVersionRequestrequiredThe 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#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\DeleteVersionRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "node_uuid": "00000000-0000-0000-0000-000000000000",
  "version_uuid": "<version uuid of the first demo model>"
}
JSON, DeleteVersionRequest::class);

// 3. The call
(new FsApi(config: $client))->deleteVersion($request);

// 4. The result
// (DeleteVersion answers no content: the call returns once it succeeded and throws an ApiException otherwise)
echo 'Done', PHP_EOL;

downloadAsZip#

PHP#
public function downloadAsZip(DownloadAsZipRequest $download_as_zip_request): \SplFileObject

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
download_as_zip_requestDownloadAsZipRequestrequiredThe request: its properties are those of the model, its JSON that of DownloadAsZip's request body.

Returns#

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

Example#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\DownloadAsZipRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "<version uuid of the first demo model>",
  "include_deleted": false,
  "format": "ZIP"
}
JSON, DownloadAsZipRequest::class);

// 3. The call
$result = (new FsApi(config: $client))->downloadAsZip($request);

// 4. The result
copy($result->getPathname(), 'download-as-zip.zip');

getNode#

PHP#
public function getNode(GetNodeRequest $get_node_request): Node

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
get_node_requestGetNodeRequestrequiredThe 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#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\GetNodeRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "path": "",
  "uuid": "<version uuid of the first demo model>",
  "version_uuid": "<version uuid of the first demo model>"
}
JSON, GetNodeRequest::class);

// 3. The call
$result = (new FsApi(config: $client))->getNode($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;

getRootNodeUuid#

PHP#
public function getRootNodeUuid(): string

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#

string — The UUID of the Root Node

Example#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

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

// 3. The call
$result = (new FsApi(config: $client))->getRootNodeUuid();

// 4. The result
echo $result, PHP_EOL;

getVersion#

PHP#
public function getVersion(GetVersionRequest $get_version_request): ModelVersion

Get a Version by its UUID.

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

Parameters#

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

Returns#

ModelVersion — Version information

Example#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\GetVersionRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "<version uuid of the first demo model>"
}
JSON, GetVersionRequest::class);

// 3. The call
$result = (new FsApi(config: $client))->getVersion($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;

listNodeErrors#

PHP#
public function listNodeErrors(ListNodeErrorsRequest $list_node_errors_request): ModelError[]

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
list_node_errors_requestListNodeErrorsRequestrequiredThe request: its properties are those of the model, its JSON that of ListNodeErrors's request body.

Returns#

ModelError[] — The errors of the given Node

Example#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\ListNodeErrorsRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "<version uuid of the first demo model>"
}
JSON, ListNodeErrorsRequest::class);

// 3. The call
$result = (new FsApi(config: $client))->listNodeErrors($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;

listNodes#

PHP#
public function listNodes(ListNodesRequest $list_nodes_request): Node[]

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

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

Parameters#

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

Returns#

Node[] — All information of the sub Nodes of the provided Node

Example#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\ListNodesRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "path": "",
  "uuid": "<version uuid of the first demo model>",
  "version_uuid": "<version uuid of the first demo model>",
  "show_deleted_nodes": false
}
JSON, ListNodesRequest::class);

// 3. The call
$result = (new FsApi(config: $client))->listNodes($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;

listNodesRecursive#

PHP#
public function listNodesRecursive(ListNodesRecursiveRequest $list_nodes_recursive_request): Node[]

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
list_nodes_recursive_requestListNodesRecursiveRequestrequiredThe request: its properties are those of the model, its JSON that of ListNodesRecursive's request body.

Returns#

Node[] — The Node and all Nodes below it

Example#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\ListNodesRecursiveRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "<version uuid of the first demo model>"
}
JSON, ListNodesRecursiveRequest::class);

// 3. The call
$result = (new FsApi(config: $client))->listNodesRecursive($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;

listVersions#

PHP#
public function listVersions(ListVersionsRequest $list_versions_request): ModelVersion[]

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
list_versions_requestListVersionsRequestrequiredThe request: its properties are those of the model, its JSON that of ListVersions's request body.

Returns#

ModelVersion[] — All information of the Versions of the given Node, or of the given Versions

Example#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\ListVersionsRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "<version uuid of the first demo model>"
}
JSON, ListVersionsRequest::class);

// 3. The call
$result = (new FsApi(config: $client))->listVersions($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;

moveNode#

PHP#
public function moveNode(MoveNodeRequest $move_node_request): Node

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
move_node_requestMoveNodeRequestrequiredThe request: its properties are those of the model, its JSON that of MoveNode's request body.

Returns#

Node — The moved Node

Example#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\MoveNodeRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "<version uuid of the first demo model>",
  "target_parent_uuid": "00000000-0000-0000-0000-000000000000"
}
JSON, MoveNodeRequest::class);

// 3. The call
$result = (new FsApi(config: $client))->moveNode($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;

undeleteNode#

PHP#
public function undeleteNode(UndeleteNodeRequest $undelete_node_request): void

Restore a previously deleted Node.

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

Parameters#

NameTypeDescription
undelete_node_requestUndeleteNodeRequestrequiredThe 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#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\UndeleteNodeRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "<version uuid of the first demo model>"
}
JSON, UndeleteNodeRequest::class);

// 3. The call
(new FsApi(config: $client))->undeleteNode($request);

// 4. The result
// (UndeleteNode answers no content: the call returns once it succeeded and throws an ApiException otherwise)
echo 'Done', PHP_EOL;

updateNode#

PHP#
public function updateNode(UpdateNodeRequest $update_node_request): Node

Update a Node.

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

Parameters#

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

Returns#

Node — The updated Node

Example#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\UpdateNodeRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "path": "",
  "uuid": "<version uuid of the first demo model>",
  "version_uuid": "<version uuid of the first demo model>",
  "name": "",
  "user_data": {}
}
JSON, UpdateNodeRequest::class);

// 3. The call
$result = (new FsApi(config: $client))->updateNode($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;

updateVersion#

PHP#
public function updateVersion(UpdateVersionRequest $update_version_request): ModelVersion

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
update_version_requestUpdateVersionRequestrequiredThe 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#

PHP#
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\FsApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\UpdateVersionRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('https://bim.works/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => "<your API token>"]));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "version_uuid": "<version uuid of the first demo model>",
  "disciplines": [
    "STRUCTURAL",
    "ARCHITECTURAL"
  ]
}
JSON, UpdateVersionRequest::class);

// 3. The call
$result = (new FsApi(config: $client))->updateVersion($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;