Skip to main content Skip to complementary content

Editing the semantic type in sandbox status using the API

Define the type of your semantic type.

  • The DICT type, based on an open or closed list of values.
  • The REGEX type that compares your data against a preselected regular expression.
  • The COMPOUND type, under which you can group several existing semantic types.

Procedure

  1. If you do not have a personal access token yet, generate one. For further information, see Generating a Personal Access Token.
  2. Open Talend API Tester in your browser.
  3. From the Repository tab, select Pqtch in the Method drop-down list.
  4. Enter the following URL: https://tds.{region}.cloud.talend.com/semanticservice/categories/{{categoryID}}}

    You'll find a list of the URLs to use for each data center in Talend Cloud regions and URLs.

    {{categoryID}} is the identifier returned when you created the semantic type, for example: 5f80848e51b6b16703a4318d.

  5. Click the Add header button and enter Authorization in the name field and Bearer followed by a whitespace and your token in the value field.
  6. Click the Add header button and enter Cookie in the name field, then leave the value field empty.
  7. In the Body field, include the semantic type details in JSON.
    • To define the semantic type as a DICT, enter:
      {
          "name": "{{DICT_NAME}}",
          "label": "{{DICT_LABEL}}",
          "type": "DICT",
          "validationMode": "{{VALIDATION_MODE}}"
      }

      where:

      • {{DICT_NAME}} is the technical name of the semantic type
      • {{DICT_LABEL}} is the name of the semantic type displayed in applications
      • DICT is the type
      • {{VALIDATION_MODE}} can be
        • SIMPLIFIED, which means that punctuation, white spaces, case, and accents are ignored during validation, and data is considered valid.
        • EXACT, which means that data is considered valid only if it is an exact match with the value.
        • EXACT_IGNORE_CASE_AND_ACCENT, which means that case and accents are ignored during validation and data is considered valid.
    • To define the semantic type as a REGEX, enter:
      {
          "name": "{{REGEX_NAME}}",
          "label": "{{REGEX_NAME}}",
          "type": "REGEX",
          "validationMode": "{{VALIDATION_MODE}}",
          "regEx": {
              "mainCategory": "{{MAIN_CATEGORY}}",
              "validator": {
                  "patternString": "{{REGEX_SYNTAX}}"
              }
          }
      }

      where:

      • {{REGEX_NAME}} is the technical name of the semantic type
      • {{REGEX_NAME}} is the name of the semantic type displayed in applications
      • REGEX is the type
      • {{VALIDATION_MODE}} can be
        • SIMPLIFIED, which means that punctuation, white spaces, case, and accents are ignored during validation, and data is considered valid.
        • EXACT, which means that data is considered valid only if it is an exact match with the value.
        • EXACT_IGNORE_CASE_AND_ACCENT, which means that case and accents are ignored during validation and data is considered valid.
      • regEx defines the regular expression:
        • {{MAIN_CATEGORY}} can be Alpha, AlphaNumeric, Numeric, BLANK, or NULL.
        • {{REGEX_SYNTAX}} is the regular expression syntax, for example: ^(?!01000|99999)(0[1-9]\\d{3}|[1-9]\\d{4})$
    • To define the semantic type as a COMPOUND, enter:
      {
          "name": "COMPOUND_NAME",
          "label": "COMPOUND_LABEL",
          "type": "COMPOUND",
          "children": [
              "{{childCategoryID}}"
          ]
      }

      where:

      • COMPOUND_NAME is the technical name of the semantic type
      • COMPOUND_LABEL is the name of the semantic type displayed in applications
      • COMPOUND is the type
      • {{childCategoryID}} is the identifier of the semantic types grouped under the one you are creating.

    Example

    {
        "name": "CODICE_FISCALE_CREATED_VIA_API",
        "label": "Codice Fiscale (created via API)",
        "type": "REGEX",
        "validationMode": "SIMPLIFIED",
        "regEx": {
            "mainCategory": "AlphaNumeric",
            "validator": {
                "patternString": "^[A-Z]{6}[0-9]{2}[A-Z][0-9]{2}[A-Z][0-9]{3}[A-Z]$"
            }
        }
    }
  8. Click Send.

Results

The API returns a 204 HTTP code to inform you that the request was successful.
You can use the GET https://tds.{region}.cloud.talend.com/semanticservice/categories?state=SANDBOX operation to list the semantic types in sandbox status. The response includes your semantic type with your modifications. For example:
    {
        "id": "5f80848e51b6b16703a4318d",
        "name": "CODICE_FISCALE_CREATED_VIA_API",
        "label": "Codice Fiscale (created via API)",
        "type": "REGEX",
        "creator": "6be3b335-05c9-4a3b-92d6-c5821f398bac",
        "creatorName": "John Doe",
        "createdAt": 1602258062631,
        "regEx": {
            "mainCategory": "AlphaNumeric",
            "validator": {
                "patternString": "^[A-Z]{6}[0-9]{2}[A-Z][0-9]{2}[A-Z][0-9]{3}[A-Z]$",
                "caseInsensitive": true,
                "re2jCompliant": true,
                "generexCompliant": true
            }
        },
        "modifiedAt": 1602262635946,
        "lastModifier": "6be3b335-05c9-4a3b-92d6-c5821f398bac",
        "lastModifierName": "John Doe",
        "completeness": false,
        "validationMode": "SIMPLIFIED",
        "state": "SANDBOX"
    }

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!