This endpoint takes in the binary content of the imported file, along with additional information about its content, and stores it in a buffer.
| URL |
Requires Auth |
HTTP Method |
/api/v1/uploadImportFile |
yes |
POST |
Headers
| Argument | Example | Required | Description |
|---|
X-User-Id | myuser-name | Required | The authenticated user ID. |
X-Auth-Token | myauth-token | Required | Auth token. |
| Argument | Example | Required | Description |
|---|
| binaryContent | /test.csv | Required | The uploaded file. |
| contentType | text/csv | Required | The imported file MIME type. |
| fileName | Testfile | Required | The name of the file to be imported. |
| importerKey | csv | Required | It indicates how Rocket.Chat should handle the uploaded file. The accepted importer keys are: csv, hipchatenterprise, pending-avatars, pending-files, slack and slack-users |
{
"binaryContent":"/testfile.csv",
"importerKey":"csv",
"fileName":"Testfile",
"contentType":"text/csv"
}
curl --location 'http://localhost:3000/api/v1/uploadImportFile' \
--header 'x-auth-token: DTRPbgzQ0EDlTE3sdd3Nt7WfaWZE-lG1ayi9Pfa28Fm' \
--header 'x-user-id: GonjPyg3gB3Z9ur9s' \
--header 'Content-Type: application/json' \
--data '{
"binaryContent":"/fole/hola",
"importerKey":"csv",
"fileName":"Tryout.csv",
"contentType":"text/csv"
}'
- Invalid Importer Key: This happens when the importer key does not match any of the accepted options.
{% tabs %}
{% tab title="Invalid Importer Key" %}
{
"success": false,
"error": "The importer (png) has no import class defined. [error-importer-not-defined]",
"errorType": "error-importer-not-defined",
"details": "uploadImportFile"
}
{% endtab %}
{% endtabs %}
| Version |
Description |
3.0.0 |
Added |