# Import File

## Description

This service imports a file for the authenticated user.

***

## Request

### Restrictions

This service requires an authenticated user and can only be called after a successful login as it Requires an authenticated user.

### Endpoint

```
POST https://<server-url>/api/v4/import/file
```

### Parameters

You can pass the following authentication credentials as query parameters or HTTP headers.

| Parameter      | Location            | Description                                                                        |
| -------------- | ------------------- | ---------------------------------------------------------------------------------- |
| `touchpoint`   | Query / Header      | The identifier for the touchpoint. Use `Thalamus-Touchpoint` for the header.       |
| `token`        | Query / Header      | The authentication token for the API session. Use `Thalamus-Token` for the header. |
| `name`         | Query / Header      | Name that identifiers the import                                                   |
| `type`         | Query / Header      | File Import type.                                                                  |
| `Content-Type` | multipart/form-data |                                                                                    |
| `file`         | (form-data)         |                                                                                    |

**SUPPORTED TYPES:**

* Physical location = 25006
* Company = 25004
* Partner Sales = 25011
* Partner Stock = 25012

### Full URL Example

```
https://<server-url>/api/v4/import/file/?name=importRest02&type=25011&touchpoint=test&token=...  "email":"jhon.smith@thalamuscorp.com",
```

\--form 'file=@"/C:/TEMP/test/PartnerSaleImporter.xlsx"'

***

## Response

### ✅ Successful Response: `200 Ok`&#x20;

* HTTP Status Code: `200 Ok`

Example Response

JSON

```
{
    "id": 277,
    "creationDate": 1758030474558,
    "modificationDate": 1758030474558,
    "creationOperator": 0,
    "modificationOperator": 0,
    "name": "importRest02",
    "fileName": "PARTNERSaleImporter_Hoy.xlsx",
    "fileType": "EXCEL",
    "owner": {
        "id": 268,
        "entityType": 25011
    },
    "relatedEntityType": null,
    "importDate": 1758030474558,
    "userId": null,
    "partnerDatasourceId": null,
    "mediumContextData": {
        "touchpointId": 3,
        "touchpointCountryId": null,
        "communicationId": null,
        "activityId": null,
        "direction": null,
        "location": null,
        "asyncExcution": false,
        "tags": null,
        "source": null,
        "countriesIds": null,
        "mediumDate": null
    },
    "mediumContextDataJson": "<com.thalamus.aaa.MediumContextData>\n  <touchpointId>3</touchpointId>\n  <asyncExcution>false</asyncExcution>\n</com.thalamus.aaa.MediumContextData>",
    "rows": 0,
    "rowsOk": 0,
    "rowsWithErrors": 0,
    "rowsSkipped": 0,
    "rowsRollbacked": 0,
    "rowsRollbackedWithErrors": 0,
    "state": "PROCESSING",
    "percentageProcessed": 0,
    "totalToProcess": 0,
    "url": null,
    "fileImportType": null,
    "fileSize": 0,
    "analysisResult": null,
    "analysisResultJson": null,
    "internationalizedState": "Processing",
    "stateInternationalizableKey": "Processing"
}
```

### ❌ Unsuccessful Response: `400 Bad Request`

* HTTP Status Code: `400 Bad Request`
* Body: A JSON object containing details about the error.

Example Response

JSON

```
{
  "errors": {
    "partnerDataSource": "TouchpointCodeRequired",
    "partnerDataSource": "InvalidTouchpointCode"
  }
}

{
    "errors": {
        "ProcessorInfo": "DuplicatedName",
        "execution.ProcessorInfo": "execution.ProcessorInfo: DuplicatedName"
    }
}
```
