## Documentation Index

Fetch the complete documentation index at: [/llms.txt](https://developer.mindbridge.ai/llms.txt)

Use this file to discover all available pages before exploring further.

# Import From Data Table

## cURL

```bash
curl --request POST \
  --url https://{tenant}.mindbridge.ai/api/v1/file-manager/import-from-data-table \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "dataTableId": "<string>",
  "engagementId": "<string>",
  "name": "<string>",
  "fields": [\n    "<string>"\n  ],
  "parentFileManagerEntityId": "<string>",
  "query": {},
  "limit": 2
}
'
```

## Python

```python
import requests

url = "https://{tenant}.mindbridge.ai/api/v1/file-manager/import-from-data-table"

payload = {
    "dataTableId": "<string>",
    "engagementId": "<string>",
    "name": "<string>",
    "fields": ["<string>"],
    "parentFileManagerEntityId": "<string>",
    "query": {},
    "limit": 2
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## JavaScript (Fetch)

```javascript
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    dataTableId: '<string>',
    engagementId: '<string>',
    name: '<string>',
    fields: ['<string>'],
    parentFileManagerEntityId: '<string>',
    query: {},
    limit: 2
  })
};

fetch('https://{tenant}.mindbridge.ai/api/v1/file-manager/import-from-data-table', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

## PHP

```php
$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://{tenant}.mindbridge.ai/api/v1/file-manager/import-from-data-table",\
  CURLOPT_RETURNTRANSFER => true,\
  CURLOPT_ENCODING => "",\
  CURLOPT_MAXREDIRS => 10,\
  CURLOPT_TIMEOUT => 30,\
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
  CURLOPT_CUSTOMREQUEST => "POST",\
  CURLOPT_POSTFIELDS => json_encode([\
    'dataTableId' => '<string>',\
    'engagementId' => '<string>',\
    'name' => '<string>',\
    'fields' => [\
        '<string>'\
    ],\
    'parentFileManagerEntityId' => '<string>',\
    'query' => [\
\
    ],\
    'limit' => 2\
  ]),\
  CURLOPT_HTTPHEADER => [\
    "Authorization: Bearer <token>",\
    "Content-Type: application/json"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

## Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

url := "https://{tenant}.mindbridge.ai/api/v1/file-manager/import-from-data-table"

payload := strings.NewReader("{\n  \"dataTableId\": \"<string>\",\n  \"engagementId\": \"<string>\",\n  \"name\": \"<string>\",\n  \"fields\": [\n    \"<string>\"\n  ],\n  \"parentFileManagerEntityId\": \"<string>\",\n  \"query\": {},\n  \"limit\": 2\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

## Response

### 201 - application/json

```json
{
  "id": "<string>",
  "version": 123,
  "creationDate": "2023-11-07T05:31:56Z",
  "lastModifiedDate": "2023-11-07T05:31:56Z",
  "createdUserInfo": {
    "userId": "<string>",
    "userName": "<string>"
  },
  "lastModifiedUserInfo": {
    "userId": "<string>",
    "userName": "<string>"
  },
  "entityId": "<string>",
  "error": "<string>",
  "errorMessage": "<string>"
}
```

### Authorizations

Authorization

string

header

required

Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.

### Body

- **dataTableId**: string (required) - The ID of the Data Table to export data from.
- **engagementId**: string (required) - The engagement that the Data Table belongs to.
- **name**: string (required) - The name for the exported CSV file without extension. Minimum string length: `1`
- **fields**: string[] (required) - The list of field names (columns) to include in the export. Minimum array length: `1` and minimum string length: `1`.
- **parentFileManagerEntityId**: string - The ID of the File Manager directory to place the exported file in. If null, the file is placed in the engagement's root directory.
- **query**: object - An optional filter to apply to the data before exporting.
- **limit**: integer<int32> - The maximum number of rows to export. Required range: `x >= 1`
