Skip to content

Quick start

This is a minimal list of steps required to start using T-API. For more details please refer to API Reference and User guide.

1. Create technical user

  1. Go to API page and click Create under Technical users section.
  2. Fill form with technical user name and confirm.
    Create technical user
  3. Click Bearer token, copy token to clipboard and save for later use.
    Copy token

2. Create data type

  1. Go to Data types page and click Create.
  2. Fill form with data type name, given sample YAML definition and confirm.

    Create data type

    Sample YAML definition
    data_type:
      header:
        type: object
        fields:
          TransactionId:
            type: string
          TransactionOwner:
            type: string
          Firstname:
            type: string
          Lastname:
            type: string
    
  3. Click Save.

3. Create template

  1. Go to Templates creator page and click Create.
  2. Fill required fields.
    Create template
  3. Create set of variables to cover all custom data fields from data type and insert them into template content.

    Template content

    Warning

    Name variable exactly like on the figure above. It is required to map data from data type to template. If you are using different Data type definition, you have to change variable names accordingly. It is concatenation of field name and descendant object name.

    For example use headerFirstname instead of Firstname if you have following data type definition:

    header:
      type: object
      fields:
      # ...
        Firstname:
          type: string
    

    You can find more datailed instruction in Template variables mapping section.

  4. Click Save.

4. Create data stream

  1. Go to Data streams page and click Create.
  2. Fill form with data stream name, select previously created Data Type and Technical user.
    Create data stream
  3. Add template configuration for created Template.

    Add template configuration

      Template name: Sample template for T-API
      Document name: Agreement %headerTransactionId%
      External ID: DOC_%headerTransactionId%
      Document reference: Agreement for %headerFirstname% %headerLastname%
    
  4. Click Save.

5. Send transaction data

  1. Using curl send POST request to given endpoint.
    curl --location 'https://ext-api.pergam.in/ext-api/v2/transactions' \
    --header 'accept: application/json' \
    --header 'Authorization: Bearer {token}' \
    --header 'Content-Type: application/json' \s
    --data-raw '{
        "transaction_data_stream": "SAMPLE_DATA_STREAM",
        "transaction_body": {
            "header": {
                "TransactionId": "SAMPLE_TRANSACTION_00001",
                "TransactionOwner": "{email}",
                "Firstname": "John",
                "Lastname": "Doe"
            }
        }
    }'
    

    Warning

    Replace {token} with Bearer token from Technical user creation step.

    Replace {email} with email address of existing user in your organization.