import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'


The **GW2RegisterImportFile** function registers a file path to the interchange file (produced as an output from export processing modes). Using this function activates the Import Process Mode for the session.

<Tabs>

<TabItem value="C++" label="C++" default>

**Synopsis**

The **GW2RegisterImportFile** function registers the file whose name is pointed to by **importFilePath** as the file it should import. The file must conform to the interchange file format. Using this function activates the Import Process Mode for the session.

```cpp

#include "glasswall.core2.api.h"
int GW2RegisterImportFile(Session session, const char *importFilePath);

```

**Returns**

Returns an integer `GW2_RetStatus` enum value. Negative numbers indicate a failure.

</TabItem>

<TabItem value="C#" label="C#">

**Synopsis**

```csharp
public int RegisterImportFile(
    int session,
    string importFilePath)

```

**Returns**

Returns an integer `GW2_RetStatus` enum value. Negative numbers indicate a failure.

</TabItem>

<TabItem value="Java" label="Java">

**Synopsis**

```java
import com.glasswall.core2javabridge.*;

public int GW2RegisterImportFile(int session, String importFilePath) throws GlasswallException, NullPointerException

(deprecated)
public int GW2RegisterImportFile(int session, byte[] importFilePath) throws GlasswallException, NullPointerException
```

**Note**

The **GW2RegisterImportFile** function parameters have been updated to use `String` in place of `byte[]`. The original function has been deprecated.

**Returns**

The **GW2RegisterImportFile** function returns a **GW2_RetStatus** enumeration converted to `int`. The value will be negative if an error occurred. `0` indicates success. Refer to the API Overview/Return types for details. 

A **NullPointerException** exception will be thrown if `importFilePath` is null or empty.

A **GlasswallException** exception will be thrown if `session` is invalid, if the `importFilePath` could not be retrieved, or if the `importFilePath` could not be converted to UTF-8.

</TabItem>

<TabItem value="Python" label="Python">

**Synopsis**

Registers a .zip file to be imported for the given session. The constructed file will be created during the session's run_session call.

```py
def register_import(self, session: int, input_file: Union[str, bytes, bytearray, io.BytesIO]):
    """ Registers a .zip file to be imported for the given session. The constructed file will be created during the session's run_session call.

    Args:
        session (int): The session integer.
        input_file (Union[str, bytes, bytearray, io.BytesIO]): The input import file path or bytes.

    Returns:
        gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attribute 'status' indicating the result of the function call. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size.
    """
```

**Returns**

gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attribute 'status' indicating the result of the function call. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size.

The status attribute is an integer `GW2_RetStatus` enum value. Negative numbers indicate a failure.

</TabItem>

<TabItem value="JavaScript" label="JavaScript">

**Synopsis**

This function registers an import file path against a specified session.

```jsx

/**
 * @param {number} session The ID of the session.
 * @param {string} importFilePath The path of the file to be registered.
 */

GW2RegisterImportFile(session, importFilePath)

```

**Returns**

Returns an integer `GW2_RetStatus` enum value. Negative numbers indicate a failure.

</TabItem>

</Tabs>