<!-- source: docs/api/4_s2s/globalfile/index.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile -->

# Global File

The new Global File API is used to access V3 of our Global Files Service. The V3 API brings new features to global files:

* Ability to organize files into sub-directories
* Ability to upload global files from the Client Libraries (by migrating an uploaded User File)

*Note that because these files are global to the app, this API has been designed with additional checks (in terms of treeIds, versions, etc.) for concurrency safety.*

Important notes:

* V3 files are stored separately from the legacy global files
* This API is not supported by the current Design Portal. 

To access the files uploaded into the [Custom Config | Files](https://portal.braincloudservers.com/admin/dashboard#/development/files) section of the portal, you need to use the legacy [S3 Handling](/api/capi/s3handling) service. 

## API Summary

### System File Retrieval APIs

*Accessible via cloud-code and S2S.*

* [SysCheckFilenameExists](/api/capi/globalfile/syscheckfilenameexists) - Check if filename exists for provided path and name.
* [SysCheckFullpathFilenameExists](/api/capi/globalfile/syscheckfullpathfilenameexists) - Check if filename exists for provided full path name.
* [SysGetGlobalFileList](/api/s2s/globalfile/sysgetglobalfilelist) - list all global files at the specified `folderPath`
* [SysGetFileInfo()](/api/s2s/globalfile/sysgetfileinfo) - returns information about the specified file, given a `fileId`.
* [SysGetFileInfoSimple()](/api/s2s/globalfile/sysgetfileinfosimple) - returns information about the specified file, given a `folderPath` + `filename`.
* [SysGetGlobalCDNUrl](/api/s2s/globalfile/sysgetglobalcdnurl) - only required for clients that don't support redirection

### File Management

* [SysMoveToGlobalFile()](/api/s2s/globalfile/sysmovetoglobalfile) - migrate a file from User Files to the Global File system
* [SysCopyGlobalFile()](/api/s2s/globalfile/syscopyglobalfile) - copy a file
* [SysMoveGlobalFile()](/api/s2s/globalfile/sysmoveglobalfile) - move (or rename) a file 
* [SysDeleteGlobalFile()](/api/s2s/globalfile/sysdeleteglobalfile) - delete a file
* [SysDeleteGlobalFiles()](/api/s2s/globalfile/sysdeleteglobalfiles) - delete the contents of a directory
* [SysPrepareUpload](/api/s2s/globalfile/sysprepareupload) - prepare for the uploading of a global file
* [SysUploadStream](/api/s2s/globalfile/sysuploadstream) - upload a global file directly

### Folder Management ###

* [SysLookupFolder](/api/s2s/globalfile/syslookupfolder) - lookup a folder given it's path
* [SysCreateFolder](/api/s2s/globalfile/syscreatefolder) - create a folder
* [SysMoveFolder](/api/s2s/globalfile/sysmovefolder) - move a folder
* [SysRenameFolder](/api/s2s/globalfile/sysrenamefolder) - rename a folder
* [SysDeleteFolder](/api/s2s/globalfile/sysdeletefolder) - delete a folder


---

<!-- source: docs/api/4_s2s/globalfile/syscheckfilenameexists.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/syscheckfilenameexists -->

# SysCheckFilenameExists

Check if filename exists for provided path and name.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_CHECK_FILENAME_EXISTS |

## Method Parameters

| Parameter  | Description      |
| ---------- | ---------------- |
| folderPath | The folder path. |
| filename   | The file name.   |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var folderPath = "";
var filename = "cccc";
var globalFileV3Proxy = bridge.getGlobalfilev3ServiceProxy();

var postResult = globalFileV3Proxy.SysCheckFilenameExists(folderPath, filename);
```

**Raw:**

```r
{
    "service":"globalFileV3",
    "operation":"SYS_CHECK_FILENAME_EXISTS",
    "data":{
        "folderPath":"",
        "filename":"cccc"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "fileDetails": {
            "treeId": "fb3431cd-6e2f-47f1-8100-8941abf6bb4f",
            "fileName": "glogcopy.json",
            "fileSize": 7051,
            "dateUploaded": 1677521119000,
            "etag": "a6f4cd3c065aed36227d3582adc5d952",
            "acl": {
                "member": 2,
                "other": 0
            },
            "version": 2,
            "url": "https://api.internal.braincloudservers.com/groupfiles/bc/g/23782/gr/2bf538d1-19ea-4e14-9862-f979215e09b7/fb3431cd-6e2f-47f1-8100-8941abf6bb4f/6d938c22-3b8c-4b99-a913-2edafed71a83/V2/glogcopy.json",
            "fileId": "6d938c22-3b8c-4b99-a913-2edafed71a83"
        },
        "groupId": "2bf538d1-19ea-4e14-9862-f979215e09b7",
        "exists": true
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/syscheckfullpathfilenameexists.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/syscheckfullpathfilenameexists -->

# SysCheckFullpathFilenameExists

Check if filename exists for provided full path name.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_CHECK_FULLPATH_FILENAME_EXISTS |

## Method Parameters

| Parameter        | Description         |
| ---------------- | ------------------- |
| fullPathFilename | The file full path. |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var fullPathFilename = "cccc";
var globalFileV3Proxy = bridge.getGlobalfilev3ServiceProxy();

var postResult = globalFileV3Proxy.SysCheckFullpathFilenameExists(fullPathFilename);
```

**Raw:**

```r
{
    "service":"globalFileV3",
    "operation":"SYS_CHECK_FULLPATH_FILENAME_EXISTS",
    "data":{
        "fullPathFilename":"cccc"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "fileDetails": {
            "treeId": "d9e937cc-750f-4414-962c-838f1af3f34a",
            "fileName": "glog.json",
            "fileSize": 7051,
            "dateUploaded": 1677183768000,
            "etag": "08c580b36ee79773bfec4a3c51bd1b64",
            "acl": {
                "member": 2,
                "other": 0
            },
            "version": 1,
            "url": "https://api.internal.braincloudservers.com/groupfiles/bc/g/23782/gr/2bf538d1-19ea-4e14-9862-f979215e09b7/d9e937cc-750f-4414-962c-838f1af3f34a/6d938c22-3b8c-4b99-a913-2edafed71a83/V1/glog.json",
            "fileId": "6d938c22-3b8c-4b99-a913-2edafed71a83"
        },
        "groupId": "2bf538d1-19ea-4e14-9862-f979215e09b7",
        "exists": true
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/syscopyglobalfile.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/syscopyglobalfile -->

# SysCopyGlobalFile

Makes a copy of the specified file.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_COPY_GLOBAL_FILE |

## Method Parameters

| Parameter          | Description                                                          |
| ------------------ | -------------------------------------------------------------------- |
| fileId             | The file id                                                          |
| version            | The current version of the file                                      |
| newTreeId          | The location in the tree for the new file. Use emptystring for root. |
| treeVersion        | The current version of the tree                                      |
| newFilename        | The filename to use for the copied file                              |
| overwriteIfPresent | Set to true to overwrite an existing file if present.                |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var fileId = "hjvfsghguhuhrtghgh";
var version = 1;
var newTreeId = "guid";
var treeVersion = 1;
var newFileName = "gfileName";
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var postResult = globalFileProxy.sysCopyGlobalFile(fileId, version, newTreeId, treeVersion, newFileName);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_COPY_GLOBAL_FILE",
    "data": {
        "fileId": "8d2e30b0-6308-4aeb-ac6a-68e4a458365b",
        "version": 1,
        "newTreeId": "",
        "treeVersion": 1,
        "newFilename": "gfile",
        "overwriteIfPresent": true
      }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "fileDetails": {
            "fileId": "8d2e30b0-6308-4aeb-ac6a-68e4a458365b",
            "treeId": "",
            "fileName": "testFile3.txt",
            "contentMd5": "ruSnJhFo5VpcvrWdweyeaw==",
            "fileSize": 19,
            "dateUploaded": 1587692400000,
            "etag": "aee4a7261168e55a5cbeb59dc1ec9e6b",
            "version": 1,
            "url": "https://api.braincloudservers.com/files/bc/g/21774/f/8d2e30b0-6308-4aeb-ac6a-68e4a458365b/V1/testFile3.txt"
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/syscreatefolder.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/syscreatefolder -->

# SysCreateFolder

Creates a new Global File folder. Returns the updated directory tree and version.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_CREATE_FOLDER |

## Method Parameters

| Parameter                | Description                                                                                            |
| ------------------------ | ------------------------------------------------------------------------------------------------------ |
| folderPath               | Parent directory path. Can include additional directories in path to quickly build a nested structure. |
| treeVersion              | Current tree version                                                                                   |
| name                     | Name of the new directory                                                                              |
| desc                     | Directory description; will be displayed in Design Portal UI (when available)                          |
| createInterimDirectories | Allows for creating multiple levels of a tree at once                                                  |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var folderPath = "";
var treeVersion = 2;
var name = "audio";
var desc = "For audio files";
var createInterimDirectories = true;

var postResult = globalFileProxy.sysCreateFolder(
    folderPath, treeVersion, name, desc, createInterimDirectories );

if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_CREATE_FOLDER",
    "data": {
        "folderPath": "",
        "treeVersion": 2,
        "name": "audio",
        "desc": "For audio files",
        "createInterimDirectories": true
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "globalTree": {
            "tree": [
                {
                    "treeId": "2188e9cf-27fa-4a33-8d06-3306f9a74bf8",
                    "children": null,
                    "name": "art",
                    "type": "Folder",
                    "desc": "Folder for art assets"
                },
                {
                    "treeId": "146cce63-da7a-40c7-bd57-5b5f81607523",
                    "children": null,
                    "name": "audio",
                    "type": "Folder",
                    "desc": "For audio files"
                }
            ],
            "treeVersion": 3
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysdeletefolder.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysdeletefolder -->

# SysDeleteFolder

Delete the specified folder (and optionally child files and subfolders). Return the updated directory tree.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_DELETE_FOLDER |

## Method Parameters

| Parameter   | Description                                        |
| ----------- | -------------------------------------------------- |
| treeId      | Tree location of the folder to delete              |
| folderPath  | Path of that tree location (as an intention check) |
| treeVersion | Current tree version                               |
| recurse     | Delete files and subfolders if not empty?          |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var treeId = "";
var folderPath = "/";
var treeVersion = 2;
var recurse = false;

var postResult = globalFileProxy.sysDeleteFolder(
    treeId, folderPath, treeVersion, recurse );

if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_DELETE_FOLDER",
    "data": {
        "treeId": "",
        "cloudPath": "/",
        "treeVersion": 2,
        "recurse": false
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "globalTree": {
            "tree": [
                {
                    "treeId": "2188e9cf-27fa-4a33-8d06-3306f9a74bf8",
                    "children": null,
                    "name": "art",
                    "type": "Folder",
                    "desc": "Folder for art assets"
                },
                {
                    "treeId": "146cce63-da7a-40c7-bd57-5b5f81607523",
                    "children": null,
                    "name": "audio",
                    "type": "Folder",
                    "desc": "For audio files"
                }
            ],
            "treeVersion": 3
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysdeleteglobalfile.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysdeleteglobalfile -->

# SysDeleteGlobalFile

Deletes the specified global file.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_DELETE_GLOBAL_FILE |

## Method Parameters

| Parameter | Description                                    |
| --------- | ---------------------------------------------- |
| fileId    | The id of the file                             |
| version   | The version of the file                        |
| filename  | The filename of the file (provided as a check) |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var fileId = "hjvfsghguhuhrtghgh";
var version = 1;
var filename = "testFile2.txt";

var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var postResult = globalFileProxy.sysDeleteGlobalFile(fileId, version, filename );
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_DELETE_GLOBAL_FILE",
    "data": {
        "fileId": "8d2e30b0-6308-4aeb-ac6a-68e4a458365b",
        "version": 1,
        "filename": "testFile2.txt"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "fileDetails": {
            "treeId": "",
            "fileName": "testFile3.txt",
            "version": 1,
            "fileId": "8d2e30b0-6308-4aeb-ac6a-68e4a458365b"
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysdeleteglobalfiles.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysdeleteglobalfiles -->

# SysDeleteGlobalFiles

```objective_c
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

Delete all the files in the specified directory. Returns a list of the files that were deleted.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_DELETE_GLOBAL_FILES |

## Method Parameters

| Parameter   | Description                                        |
| ----------- | -------------------------------------------------- |
| treeId      | Tree location to delete all files                  |
| folderPath  | Path of that tree location (as an intention check) |
| treeVersion | Current tree version                               |
| recurse     | Delete files in subdirectories as well?            |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var treeId = "";
var folderPath = "/";
var treeVersion = 2;
var recurse = false;

var postResult = globalFileProxy.sysDeleteGlobalFiles(
    fileId, folderPath, treeVersion, recurse );

if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_DELETE_GLOBAL_FILES",
    "data": {
        "treeId": "",
        "cloudPath": "/",
        "treeVersion": 2,
        "recurse": false
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "deletedFiles": [
            {
                "treeId": "",
                "fileName": "testFile3.txt",
                "version": 1,
                "fileId": "34abacc5-c048-4bcc-a3ce-8eb751a718a6"
            },
            {
                "treeId": "",
                "fileName": "testFile2.txt",
                "version": 1,
                "fileId": "d77122cc-f87b-4f98-801f-e49568d7061f"
            },
            {
                "treeId": "",
                "fileName": "testFile1.txt",
                "version": 1,
                "fileId": "ed126aaa-27de-48c7-b650-18e7af52ccb9"
            }
        ]
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysgetfileinfo.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysgetfileinfo -->

# SysGetFileInfo

Returns information on the specified file.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_GET_FILE_INFO |

## Method Parameters

| Parameter | Description |
| --------- | ----------- |
| fileId    | File ID     |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var fileId = "hjvfsghguhuhrtghgh";
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var postResult = globalFileProxy.sysGetFileInfo(fileId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_GET_FILE_INFO",
    "data": {
        "fileId": "hjvfsghguhuhrtghgh"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "fileDetails": {
            "fileId": "4d0b8945-41f8-4a2b-a2f5-e9c0b2482bc6",
            "contentMd5": "0snE+wsqo2XeseZbT5kLyQ==",
            "treeId": "ff81c691-5683-4aa0-addb-6f89ecd3ce75",
            "fileName": "sub12file1",
            "fileSize": 64,
            "dateUploaded": 1586975354000,
            "etag": "d2c9c4fb0b2aa365deb1e65b4f990bc9",
            "version": 1,
            "url": "https://api.braincloudservers.com/files/bc/g/23302/f/xxxx-xxx-xxx-xxx/yyy-yyy-yyy-yyy/V1/sub12file1"
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysgetfileinfosimple.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysgetfileinfosimple -->

# SysGetFileInfoSimple

Given a path and filename, returns information on the corresponding file.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_GET_FILE_INFO_SIMPLE |

## Method Parameters

| Parameter  | Description      |
| ---------- | ---------------- |
| folderPath | path to the file |
| filename   | filename         |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var folderPath = "/root1/sub11/sub12/";
var filename = "sub12file1";
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var postResult = globalFileProxy.sysGetFileInfoSimple(folderPath, filename);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_GET_FILE_INFO_SIMPLE",
    "data": {
        "folderPath": "/root1/sub11/sub12/",
        "filename": "sub12file1"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "fileDetails": {
            "fileId": "4d0b8945-41f8-4a2b-a2f5-e9c0b2482bc6",
            "contentMd5": "0snE+wsqo2XeseZbT5kLyQ==",
            "treeId": "ff81c691-5683-4aa0-addb-6f89ecd3ce75",
            "fileName": "sub12file1",
            "fileSize": 64,
            "dateUploaded": 1586975354000,
            "etag": "d2c9c4fb0b2aa365deb1e65b4f990bc9",
            "version": 1,
            "url": "https://api.braincloudservers.com/files/bc/g/23302/f/xxxx-xxx-xxx-xxx/yyy-yyy-yyy-yyy/V1/sub12file1"
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysgetglobalcdnurl.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysgetglobalcdnurl -->

# SysGetGlobalCDNUrl

Returns the CDN URL for the specified file.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_GET_GLOBAL_CDN_URL |

## Method Parameters

| Parameter | Description |
| --------- | ----------- |
| fileId    | File ID     |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var fileId = "hjvfsghguhuhrtghgh";
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var postResult = globalFileProxy.sysGetGlobalCDNUrl(fileId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_GET_GLOBAL_CDN_URL",
    "data": {
        "fileId": "hjvfsghguhuhrtghgh"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "appServerUrl": "https://api.braincloudservers.com/...f434b1db538b/f/uploadsimplefile.txt",
        "cdnUrl": "https://d2b6zwnvr1nyug.cloudfront.net/bc/g/20001/u/107b3aa9-0d9f-4e90-af..."
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysgetglobalfilelist.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysgetglobalfilelist -->

# SysGetGlobalFileList

Retrieves the list of global files stored at the specified directory location.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_GET_GLOBAL_FILE_LIST |

## Method Parameters

| Parameter  | Description                                                        |
| ---------- | ------------------------------------------------------------------ |
| folderPath | Directory location of the files. Use empty string or "/" for root. |
| recurse    | Whether to recurse into subdirectories                             |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var folderPath = "";
var recurse = true;

var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var postResult = globalFileProxy.sysGetGlobalFileList(folderPath, recurse);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_GET_GLOBAL_FILE_LIST",
    "data": {}
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "treeVersion": 2,
        "fileList": {
            "treeId": "",
            "folderPath": "/",
            "name": "",
            "folders": {
                "art": {
                    "treeId": "2188e9cf-27fa-4a33-8d06-3306f9a74bf8",
                    "folderPath": "/art/",
                    "name": "art",
                    "folders": {},
                    "files": {
                        "image.png": {
                            "fileId": "bf9de8db-8cd8-44ac-b43c-b91ecd312e13",
                            "fileName": "image.png",
                            "fileSize": 5678,
                            "version": 1,
                            "url": "https://api.braincloudservers.com/files/bc/g/21774/f/2188e9cf-27fa-4a33-8d06-3306f9a74bf8/bf9de8db-8cd8-44ac-b43c-b91ecd312e13/V1/image.png"
                        }
                    }
                }
            },
            "files": {
                "testFile2.txt": {
                    "fileId": "6f6420b3-e641-43b7-8f32-20c16af208e0",
                    "fileName": "testFile2.txt",
                    "fileSize": 2256,
                    "version": 1,
                    "url": "https://api.braincloudservers.com/files/bc/g/21774/f/6f6420b3-e641-43b7-8f32-20c16af208e0/V1/testFile2.txt"
                },
                "testFile1.txt": {
                    "fileId": "b2175eae-5b7a-4813-93d3-527600db7d73",
                    "fileName": "testFile1.txt",
                    "fileSize": 1214,
                    "version": 1,
                    "url": "https://api.braincloudservers.com/files/bc/g/21774/f/b2175eae-5b7a-4813-93d3-527600db7d73/V1/testFile1.txt"
                }
            }
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/syslookupfolder.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/syslookupfolder -->

# SysLookupFolder

Returns the treeId for the specified folder.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_LOOKUP_FOLDER |

## Method Parameters

| Parameter      | Description                 |
| -------------- | --------------------------- |
| fullFolderPath | Fully folder path to lookup |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var fullFolderPath = "audio/xxx/tempdir";

var postResult = globalFileProxy.sysLookupFolder(fullFolderPath);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_LOOKUP_FOLDER",
    "data": {
        "fullFolderPath": "audio/xxx/tempdir"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "treeId": "56b1c593-92d2-4e49-a997-0e493111d7b2",
        "folderPath": "audio/xxx/tempdir",
        "treeVersion": 3
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysmovefolder.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysmovefolder -->

# SysMoveFolder

```objective_c
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

Move a folder (and its contents). Returns the updated directory tree.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_MOVE_FOLDER |

## Method Parameters

| Parameter                | Description                                                         |
| ------------------------ | ------------------------------------------------------------------- |
| treeId                   | The id of the folder to move                                        |
| treeVersion              | Current tree version                                                |
| newCloudPath             | New path to move the folder to                                      |
| updatedName              | Updated name for the folder                                         |
| createInterimDirectories | Create any sub-folders that don't already exist in `newCloudPath` ? |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var treeId = "56b1c593-92d2-4e49-a997-0e493111d7b2";
var treeVersion = 4;
var newCloudPath = "xaudio/yyy";
var updatedName = "tempdir";
var createInterimDirectories = true;

var postResult = globalFileProxy.sysMoveFolder(
    treeId, treeVersion, newCloudPath, updatedName, createInterimDirectories );

if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_GET_GLOBAL_CDN_URL",
    "data": {
        "treeId": "56b1c593-92d2-4e49-a997-0e493111d7b2",
        "treeVersion": 4,
        "newCloudPath": "xaudio/yyy",
        "updatedName": "tempdir",
        "createInterimDirectories": true
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "globalTree": {
            "tree": [
                {
                    "treeId": "2188e9cf-27fa-4a33-8d06-3306f9a74bf8",
                    "name": "art",
                    "type": "Folder",
                    "desc": "Folder for art assets",
                    "children": null
                },
                {
                    "treeId": "146cce63-da7a-40c7-bd57-5b5f81607523",
                    "name": "audio",
                    "type": "Folder",
                    "desc": "For audio files",
                    "children": [
                        {
                            "treeId": "1330b5c1-5af4-46d9-820e-c0de1c109366",
                            "name": "xxx",
                            "type": "Folder",
                            "desc": null,
                            "children": null
                        }
                    ]
                },
                {
                    "treeId": "4a98c288-e1ab-4cb8-bdf4-66f7d4ea0739",
                    "name": "xaudio",
                    "type": "Folder",
                    "desc": "",
                    "children": [
                        {
                            "treeId": "02888d60-3caa-4b9a-b9b0-9d8eac5d410d",
                            "name": "yyy",
                            "type": "Folder",
                            "desc": "",
                            "children": [
                                {
                                    "treeId": "56b1c593-92d2-4e49-a997-0e493111d7b2",
                                    "name": "tempdir",
                                    "type": "Folder",
                                    "desc": "Seeing how multilevel works",
                                    "children": null
                                }
                            ]
                        }
                    ]
                }
            ],
            "treeVersion": 5
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysmoveglobalfile.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysmoveglobalfile -->

# SysMoveGlobalFile

Move or rename the specified file.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_MOVE_GLOBAL_FILE |

## Method Parameters

| Parameter          | Description                                                           |
| ------------------ | --------------------------------------------------------------------- |
| fileId             | File ID                                                               |
| version            | File version                                                          |
| newTreeId          | Id of the new location for the file                                   |
| treeVersion        | Current tree version (used to prevent concurrency errors)             |
| newFilename        | New name for the file                                                 |
| overwriteIfPresent | If a file of that name already exists at that location, overwrite it? |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var fileId = "742f46ad-cab2-4f62-9ac4-c7c5b6f0e13b";
var version = 1;
var newTreeId = "2188e9cf-27fa-4a33-8d06-3306f9a74bf8";
var treeVersion = 2;
var newFilename = "testFile1.txt";
var overwriteIfPresent = true;

var postResult = globalFileProxy.sysMoveGlobalFile(
    fileId, version, newTreeId, treeVersion, newFilename, overwriteIfPresent );

if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_MOVE_GLOBAL_FILE",
    "data": {
        "fileId": "742f46ad-cab2-4f62-9ac4-c7c5b6f0e13b",
        "version": 1,
        "newTreeId": "2188e9cf-27fa-4a33-8d06-3306f9a74bf8",
        "treeVersion": 2,
        "newFilename": "testFile1.txt",
        "overwriteIfPresent": true,
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "fileId": "b0cc8e28-ab5d-4a6c-94c3-476549128eaa",
        "treeId": "2188e9cf-27fa-4a33-8d06-3306f9a74bf8",
        "fileName": "testFile1.txt",
        "contentMd5": "ruSnJhFo5VpcvrWdweyeaw==",
        "fileSize": 19,
        "dateUploaded": 1587694790000,
        "etag": "aee4a7261168e55a5cbeb59dc1ec9e6b",
        "version": 1,
        "url": "https://api.braincloudservers.com/files/bc/g/21774/f/2188e9cf-27fa-4a33-8d06-3306f9a74bf8/b0cc8e28-ab5d-4a6c-94c3-476549128eaa/V1/testFile1.txt"
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysmovetoglobalfile.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysmovetoglobalfile -->

# SysMoveToGlobalFile

Copies the specified User File to the Global File V3 system.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_MOVE_TO_GLOBAL_FILE |

## Method Parameters

| Parameter          | Description                                 |
| ------------------ | ------------------------------------------- |
| userProfileId      | ProfileId of the user to copy the file from |
| userCloudPath      | Directory of the file in User Files         |
| userCloudFilename  | Filename of the user file                   |
| globalTreeId       | TreeId to move the file to                  |
| globalFilename     | Filename to use in global files             |
| overwriteIfPresent | Overwrite the file if it already exists?    |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var userProfileId = "c32c330f-d84d-4e7f-a405-a972d28fe933";
var userCloudPath = "textFile";
var userCloudFilename = "testFile3.txt";
var globalTreeId =  "";
var globalFilename = "testFile3.txt";
var overwriteIfPresent = true;

var postResult = globalFileProxy.sysMoveToGlobalFile(
    userProfileId, userCloudPath, userCloudFilename, globalTreeId, globalFilename, overwriteIfPresent );

if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_MOVE_TO_GLOBAL_FILE",
    "data": {
        "userProfileId": "c32c330f-d84d-4e7f-a405-a972d28fe933",
        "userCloudPath": "textFile",
        "userCloudFilename": "testFile3.txt",
        "globalTreeId": "",
        "globalFilename": "testFile3.txt",
        "overwriteIfPresent": true
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "fileId": "34abacc5-c048-4bcc-a3ce-8eb751a718a6",
        "treeId": "",
        "fileName": "testFile3.txt",
        "contentMd5": "2mmQd5nAOUhpptej1Gf5wA==",
        "fileSize": 20,
        "dateUploaded": 1587695812000,
        "etag": "da69907799c0394869a6d7a3d467f9c0",
        "version": 1,
        "url": "https://api.braincloudservers.com/files/bc/g/21774/f/34abacc5-c048-4bcc-a3ce-8eb751a718a6/V1/testFile3.txt"
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysprepareupload.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysprepareupload -->

# SysPrepareUpload
Prepare for the uploading of a global file.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_PREPARE_UPLOAD |

## Method Parameters
Parameter | Description
--------- | -----------
treeId | The id of the folder (optional). Defaults to root folder.
filename | The destination file name.
fileSize | File size (in bytes) to be uploaded.
overwriteIfPresent | Whether to allow overwrite of an existing file if present (optional). Defaults to false.

> **Tip:** Using these results (specifically the `uploadUrl` value from the repspnse of `SysPrepareUpload`), to finally upload the file. The following template can be used to upload the file
> 
> ```shell
> curl -X POST "https://api.braincloudservers.com/s2suploader/globalfile/upload?gameId=23782&uploadId=6b24c759-6c9f-44b7-a8d5-a493f3d4b6cb&filename=testfile.txt&overwriteIfPresent=true&fileSize=352" -F "file=@testfile.txt"
> ```
> 

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var treeId = "xxxx-yyyy-zzzz";
var filename = "myglobalfile.json";
var fileSize = 47;
var overwriteIfPresent = True;
var globalFileV3Proxy = bridge.getGlobalfilev3ServiceProxy();

var postResult = globalFileV3Proxy.sysPrepareUpload(treeId, filename, fileSize, overwriteIfPresent);
```

**Raw:**

```r
{
    "service":"globalFileV3",
    "operation":"SYS_PREPARE_UPLOAD",
    "data":{
        "treeId":"xxxx-yyyy-zzzz",
        "filename":"myglobalfile.json",
        "fileSize":47,
        "overwriteIfPresent":true
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "fileDetails": {
        "gameId": "23782",
        "shareable": false,
        "uploadId": "4848d54f-c8f9-4c7e-9ab4-8c68c040cf95",
        "replaceIfExists": true,
        "cloudPath": "_root_",
        "expiresAt": 1768671291708,
        "createdAt": 1768066491708,
        "uploadUrl": "/s2suploader/globalfile/upload?gameId=23782&uploadId=4848d54f-c8f9-4c7e-9ab4-8c68c040cf95&filename=before.json&overwriteIfPresent=true&fileSize=352",
        "fileSize": 352,
        "profileId": "_S2S_",
        "localPath": null,
        "cloudFilename": "before.json",
        "fileType": "Global",
        "updatedAt": 1768066491708
    }
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysrenamefolder.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysrenamefolder -->

# SysRenameFolder

Rename the specified folder.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_RENAME_FOLDER |

## Method Parameters

| Parameter   | Description                    |
| ----------- | ------------------------------ |
| treeId      | The id of the folder to rename |
| treeVersion | The current tree version       |
| updatedName | The updated name of the folder |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var globalFileProxy = bridge.getGlobalFileV3ServiceProxy();

var treeId = "56b1c593-92d2-4e49-a997-0e493111d7b2";
var treeVersion = 5;
var updatedName = "tempdir2";

var postResult = globalFileProxy.sysRenameFolder(
    treeId, treeVersion, updatedName );

if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "globalFileV3",
    "operation": "SYS_RENAME_FOLDER",
    "data": {
        "treeId": "56b1c593-92d2-4e49-a997-0e493111d7b2",
        "treeVersion": 5,
        "updatedName": "tempdir2"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "globalTree": {
            "tree": [
                {
                    "treeId": "2188e9cf-27fa-4a33-8d06-3306f9a74bf8",
                    "name": "art",
                    "type": "Folder",
                    "desc": "Folder for art assets",
                    "children": null
                },
                {
                    "treeId": "146cce63-da7a-40c7-bd57-5b5f81607523",
                    "name": "audio",
                    "type": "Folder",
                    "desc": "For audio files",
                    "children": [
                        {
                            "treeId": "1330b5c1-5af4-46d9-820e-c0de1c109366",
                            "name": "xxx",
                            "type": "Folder",
                            "desc": null,
                            "children": null
                        }
                    ]
                },
                {
                    "treeId": "4a98c288-e1ab-4cb8-bdf4-66f7d4ea0739",
                    "name": "xaudio",
                    "type": "Folder",
                    "desc": "",
                    "children": [
                        {
                            "treeId": "02888d60-3caa-4b9a-b9b0-9d8eac5d410d",
                            "name": "yyy",
                            "type": "Folder",
                            "desc": "",
                            "children": [
                                {
                                    "treeId": "56b1c593-92d2-4e49-a997-0e493111d7b2",
                                    "name": "tempdir2",
                                    "type": "Folder",
                                    "desc": "Seeing how multilevel works",
                                    "children": null
                                }
                            ]
                        }
                    ]
                }
            ],
            "treeVersion": 6
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/globalfile/sysuploadstream.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/globalfile/sysuploadstream -->

# SysUploadStream
Upload a global file directly.

| Service | Operation |
| ------- | --------- |
| globalFileV3 | SYS_UPLOAD_STREAM |

## Method Parameters
Parameter | Description
--------- | -----------
treeId | The id of the folder (optional). Default is the root folder.
filename | The destination file name.
overwriteIfPresent | Whether to allow overwrite of an existing file if present (optional). Default is false.
fileData | Base64 encoded file contents.

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var treeId = "xxxx-yyyy-zzzz";
var filename = "myglobalfile.json";
var overwriteIfPresent = True;
var fileData = "alsjfalfjaeiojefjkjbjldjflekf";
var globalFileV3Proxy = bridge.getGlobalfilev3ServiceProxy();

var postResult = globalFileV3Proxy.sysUploadStream(treeId, filename, overwriteIfPresent, fileData);
```

**Raw:**

```r
{
    "service":"globalFileV3",
    "operation":"SYS_UPLOAD_STREAM",
    "data":{
        "treeId":"xxxx-yyyy-zzzz",
        "filename":"myglobalfile.json",
        "overwriteIfPresent":true,
        "fileData":"alsjfalfjaeiojefjkjbjldjflekf"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "fileDetails": {
        "contentMd5": "\"83252e036cd096de9198039e3d19a121\"",
        "treeId": "b6fb0efe-2d15-4a25-b43b-72684d7c788f",
        "fileName": "cloudfilename.txt",
        "fileSize": 36,
        "dateUploaded": 1768152547000,
        "etag": "\"83252e036cd096de9198039e3d19a121\"",
        "version": 1,
        "url": "https://api.braincloudservers.com/files/bc/g/23782/f/b6fb0efe-2d15-4a25-b43b-72684d7c788f/559a430c-078e-4107-9e37-2a74ba2c2fa5/V1/cloudfilename.txt",
        "fileId": "559a430c-078e-4107-9e37-2a74ba2c2fa5"
    }
}
```

</details>
