<commit_before># How-to: Import tag data into Profiles

## Prerequisites

 - Profiles account with admin role

## Import procedure

The **ProfilesTransactionRequest** supports easy import of tag data sets, including
production batch relationships, additional tag data and custom defined data, such as
arbitrary Objects, Objects Addresses, Relationships and Metadata.

Importing tags is done in a two-step procedure:

1. Collect all tag data and construct a **ProfilesTransactionRequest** from that data
   (the import account needed to construct the request is the domain after the '@' of
   the user email address in most cases)
2. Add a production batch by calling **addBatch**
3. Add all tags by calling **addTag** (this will automatically create the batch
   relationship)
4. Add related tag metadata by calling **addTagData**
5. Create a **ProfilesRestClient** instance and call **importProfilesData** with the
   previously created **importProfilesData** object

## Notes on tag metadata:

The tag metadata keys have the format **tag:{appId}:{valueType}**

The **appId** can be freely chosen.

The **valueType** shall have one of the following types:
 - **value** represents normal tag data
 - **locked** defined the access conditions of a value
   (true = read only, fales = read and write)
 - **key** represents a tag key to access data
 - **auth** represents a secret to be used for authentication

## Code Samples

First check if the user has access privileges to import data into Profiles. This can
be done by submitting an empty import request:

    String[] account = user.split("@");
    if (account.length != 2)
    {
        throw new Exception("Settings: User is no valid e-mail address");
    }
    ProfilesRestClient client= new ProfilesRestClient(server, user, password);
    ProfilesTransactionRequest req = new ProfilesTransactionRequest(account[1]);
    ProfilesRestResult result = client.importProfilesData(req);
    switch (result.httpStatus) {
        case 200:
            if (result.iCode == 1)
                sResult = "OK";<commit_msg>Profiles RestClient: updated documentation for tag import<commit_after># How-to: Import tag data into Profiles

## Prerequisites

 - Profiles account with admin role

**Important notes:**

 - This API is primarily designed to be used on Profiles developer instances.
 - On productive instances, such as SMART COSMOS Profiles, data import is restricted
   and not available for normal users.

## Import procedure

The **ProfilesTransactionRequest** supports easy import of tag data sets, including
production batch relationships, additional tag data and custom defined data, such as
arbitrary Objects, Objects Addresses, Relationships and Metadata.

Importing tags is done in a two-step procedure:

1. Collect all tag data and construct a **ProfilesTransactionRequest** from that data
   (the import account needed to construct the request is the domain after the '@' of
   the user email address in most cases)
2. Add a production batch by calling **addBatch**
3. Add all tags by calling **addTag** (this will automatically create the batch
   relationship)
4. Add related tag metadata by calling **addTagData**
5. Create a **ProfilesRestClient** instance and call **importProfilesData** with the
   previously created **importProfilesData** object

## Notes on tag metadata:

The tag metadata keys have the format **tag:{appId}:{valueType}**

The **appId** can be freely chosen.

The **valueType** shall have one of the following types:
 - **value** represents normal tag data
 - **locked** defined the access conditions of a value
   (**true** = read only, **false** = read and write)
 - **key** represents a tag key to access data
 - **auth** represents a secret to be used for authentication

## Code Samples

First check if the user has access privileges to import data into Profiles. This can
be done by submitting an empty import request:

    String[] account = user.split("@");
    if (account.length != 2)
    {
        throw new Exception("Settings: User is no valid e-mail address");
    }
    ProfilesRestClient client= new ProfilesRestClient(server, user, password);
    ProfilesTransactionRequest req = new ProfilesTransactionRequest(account[1]);
    ProfilesRestResult result = client.importProfilesData(req);
    switch (result.httpStatus) {
        case 200:
            if (result.iCode == 1)
                sResult = "OK";
{'fraction_non_alphanumeric': 0.08165116806532094, 'fraction_numerical': 0.004989793603991835, 'mean_word_length': 4.1160092807424595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5198455', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1097, 'n_words': 547}