---
title: FsApi
summary: PHP SDK: the Fs - FileSystem operations, 16 methods, each with its parameters, result and a complete example.
order: 17
languages: [php]
sdk-package: PHP SDK · BIMworks
link-terms: true
---

# FsApi

[[page:reference/sdk/php|PHP SDK]] · `BIMworks\Api` · class · 16 methods

BIM.works repository's virtual filesystem related calls.

Construct it with the client of [[page:reference/sdk/php#connect|the connect step]]: `new FsApi(config: $client)`. Each method is one operation of the [[page:api|API part]], where it runs on its page.

<table class="dense">
<thead><tr><th>Method</th><th>Operation</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>[[page:reference/sdk/php/fsapi#createnode|createNode]]</code></td><td>[[openapi:CreateNode]]</td><td>Create a new Node</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#deletenode|deleteNode]]</code></td><td>[[openapi:DeleteNode]]</td><td>Delete a Node</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#deletenodeerror|deleteNodeError]]</code></td><td>[[openapi:DeleteNodeError]]</td><td>Clear an error of a Node</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#deleteversion|deleteVersion]]</code></td><td>[[openapi:DeleteVersion]]</td><td>Delete a Version of a Node</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#downloadaszip|downloadAsZip]]</code></td><td>[[openapi:DownloadAsZip]]</td><td>Download a folder Node and everything below it as a ZIP file</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#getnode|getNode]]</code></td><td>[[openapi:GetNode]]</td><td>Get Node based on a given path, by its UUID or by the UUID of one of its Versions.</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#getrootnodeuuid|getRootNodeUuid]]</code></td><td>[[openapi:GetRootNodeUuid]]</td><td>Get the UUID of the current root Node.</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#getversion|getVersion]]</code></td><td>[[openapi:GetVersion]]</td><td>Get a Version by its UUID</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#listnodeerrors|listNodeErrors]]</code></td><td>[[openapi:ListNodeErrors]]</td><td>Get the errors of the given Node</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#listnodes|listNodes]]</code></td><td>[[openapi:ListNodes]]</td><td>Get a list of Nodes that are children of the given Node</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#listnodesrecursive|listNodesRecursive]]</code></td><td>[[openapi:ListNodesRecursive]]</td><td>Get all Nodes below the given Node, recursively</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#listversions|listVersions]]</code></td><td>[[openapi:ListVersions]]</td><td>Get a list of all the Versions of the given Node, or the given Versions</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#movenode|moveNode]]</code></td><td>[[openapi:MoveNode]]</td><td>Move a Node to another parent folder</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#undeletenode|undeleteNode]]</code></td><td>[[openapi:UndeleteNode]]</td><td>Restore a previously deleted Node</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#updatenode|updateNode]]</code></td><td>[[openapi:UpdateNode]]</td><td>Update a Node</td></tr>
<tr><td><code>[[page:reference/sdk/php/fsapi#updateversion|updateVersion]]</code></td><td>[[openapi:UpdateVersion]]</td><td>Change a Version's disciplines or alignment</td></tr>
</tbody>
</table>

## `createNode` {#createnode}

```php
public function createNode(CreateNodeRequest $create_node_request): Node
```

Create a new Node.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:CreateNode]] · <code>POST /openapi/fs/CreateNode</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>create_node_request</code></td><td><code>[[page:reference/sdk/php/models#CreateNodeRequest|CreateNodeRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:CreateNode]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#Node|Node]]</code> — 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_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` {#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.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:DeleteNode]] · <code>POST /openapi/fs/DeleteNode</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>delete_node_request</code></td><td><code>[[page:reference/sdk/php/models#DeleteNodeRequest|DeleteNodeRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:DeleteNode]]'s request body.</td></tr>
</tbody>
</table>

### 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "BIM_WORKS_FIRST_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` {#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.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:DeleteNodeError]] · <code>POST /openapi/fs/DeleteNodeError</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>delete_node_error_request</code></td><td><code>[[page:reference/sdk/php/models#DeleteNodeErrorRequest|DeleteNodeErrorRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:DeleteNodeError]]'s request body.</td></tr>
</tbody>
</table>

### 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_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` {#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.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:DeleteVersion]] · <code>POST /openapi/fs/DeleteVersion</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>delete_version_request</code></td><td><code>[[page:reference/sdk/php/models#DeleteVersionRequest|DeleteVersionRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:DeleteVersion]]'s request body.</td></tr>
</tbody>
</table>

### 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "node_uuid": "00000000-0000-0000-0000-000000000000",
  "version_uuid": "BIM_WORKS_FIRST_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` {#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.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:DownloadAsZip]] · <code>POST /openapi/fs/DownloadAsZip</code></td></tr>
<tr><th>Scope</th><td>[[scope:model:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>download_as_zip_request</code></td><td><code>[[page:reference/sdk/php/models#DownloadAsZipRequest|DownloadAsZipRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:DownloadAsZip]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>\SplFileObject</code> — The ZIP file, or with <code>format</code> <code>ZIP_ZST</code> 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "BIM_WORKS_FIRST_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` {#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.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:GetNode]] · <code>POST /openapi/fs/GetNode</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>get_node_request</code></td><td><code>[[page:reference/sdk/php/models#GetNodeRequest|GetNodeRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:GetNode]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#Node|Node]]</code> — 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "path": "",
  "uuid": "BIM_WORKS_FIRST_MODEL",
  "version_uuid": "BIM_WORKS_FIRST_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` {#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.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:GetRootNodeUuid]] · <code>GET /openapi/fs/GetRootNodeUuid</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:read]]</td></tr>
</tbody>
</table>

### Parameters

None: the operation takes no request.

### Returns

<code>string</code> — 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_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` {#getversion}

```php
public function getVersion(GetVersionRequest $get_version_request): ModelVersion
```

Get a Version by its UUID.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:GetVersion]] · <code>POST /openapi/fs/GetVersion</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>get_version_request</code></td><td><code>[[page:reference/sdk/php/models#GetVersionRequest|GetVersionRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:GetVersion]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#ModelVersion|ModelVersion]]</code> — 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "BIM_WORKS_FIRST_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` {#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.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ListNodeErrors]] · <code>POST /openapi/fs/ListNodeErrors</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>list_node_errors_request</code></td><td><code>[[page:reference/sdk/php/models#ListNodeErrorsRequest|ListNodeErrorsRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ListNodeErrors]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#ModelError|ModelError]][]</code> — 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "BIM_WORKS_FIRST_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` {#listnodes}

```php
public function listNodes(ListNodesRequest $list_nodes_request): Node[]
```

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

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ListNodes]] · <code>POST /openapi/fs/ListNodes</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>list_nodes_request</code></td><td><code>[[page:reference/sdk/php/models#ListNodesRequest|ListNodesRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ListNodes]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#Node|Node]][]</code> — 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "path": "",
  "uuid": "BIM_WORKS_FIRST_MODEL",
  "version_uuid": "BIM_WORKS_FIRST_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` {#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.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ListNodesRecursive]] · <code>POST /openapi/fs/ListNodesRecursive</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>list_nodes_recursive_request</code></td><td><code>[[page:reference/sdk/php/models#ListNodesRecursiveRequest|ListNodesRecursiveRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ListNodesRecursive]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#Node|Node]][]</code> — 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "BIM_WORKS_FIRST_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` {#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.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ListVersions]] · <code>POST /openapi/fs/ListVersions</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>list_versions_request</code></td><td><code>[[page:reference/sdk/php/models#ListVersionsRequest|ListVersionsRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ListVersions]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#ModelVersion|ModelVersion]][]</code> — 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "BIM_WORKS_FIRST_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` {#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.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:MoveNode]] · <code>POST /openapi/fs/MoveNode</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>move_node_request</code></td><td><code>[[page:reference/sdk/php/models#MoveNodeRequest|MoveNodeRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:MoveNode]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#Node|Node]]</code> — 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "BIM_WORKS_FIRST_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` {#undeletenode}

```php
public function undeleteNode(UndeleteNodeRequest $undelete_node_request): void
```

Restore a previously deleted Node.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:UndeleteNode]] · <code>POST /openapi/fs/UndeleteNode</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>undelete_node_request</code></td><td><code>[[page:reference/sdk/php/models#UndeleteNodeRequest|UndeleteNodeRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:UndeleteNode]]'s request body.</td></tr>
</tbody>
</table>

### 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "BIM_WORKS_FIRST_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` {#updatenode}

```php
public function updateNode(UpdateNodeRequest $update_node_request): Node
```

Update a Node.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:UpdateNode]] · <code>POST /openapi/fs/UpdateNode</code></td></tr>
<tr><th>Scope</th><td>[[scope:fs:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>update_node_request</code></td><td><code>[[page:reference/sdk/php/models#UpdateNodeRequest|UpdateNodeRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:UpdateNode]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#Node|Node]]</code> — 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "path": "",
  "uuid": "BIM_WORKS_FIRST_MODEL",
  "version_uuid": "BIM_WORKS_FIRST_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` {#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.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:UpdateVersion]] · <code>POST /openapi/fs/UpdateVersion</code></td></tr>
<tr><th>Scope</th><td>[[scope:model:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>update_version_request</code></td><td><code>[[page:reference/sdk/php/models#UpdateVersionRequest|UpdateVersionRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:UpdateVersion]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#ModelVersion|ModelVersion]]</code> — 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('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "version_uuid": "BIM_WORKS_FIRST_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;
```
