Skip to main content
Skip table of contents

Exports API

Data Compliance

Omilia OCP® Data Warehouse and Exports API comply with General Data Protection Regulation (GDPR) requirements. For any data type exported from OCP through Exports API, the OCP users are responsible to ensure that their exported data is handled accordingly and meets necessary regulations.

Overview

Export Service is a dedicated service that allows OCP users to gain access to their raw application data.

Export API Includes two different functionalities: Batch Export and Streaming Export. For billing information about Streaming Export, please coordinate with your Account Manager.

Read more about the Export Service features in the Export Service User Guide.

Export API is crucial for OCP users who want to retrieve, export, and manage their raw application data within the specified constraints and authentication mechanisms. Here is a brief overview of what Export API could assist with:

  1. Access to Raw Application Data: The Export Service allows users to access their raw application data.

  2. Exporting Call Detail Records (CDRs): The API supports the export of Call Detail Records (CDRs) for a specific time range. The API allows users to request CDRs for specific types of data, such as Dialog Data or ALL, which include Dialog Step, Dialog Start, Dialog End, dialog_step, dialog_start, dialog_end, vb_enrolment, vb_verification, audit.

Dialog Data, Dialog Step, Dialog Start, and Dialog End are planned to be deprecated in later versions of the Exports API. After that, ALL will be available instead of Dialog Data, dialog_step instead of Dialog Step, dialog_start instead of Dialog Start, dialog_end instead of Dialog End.

  1. Export Creation: Users can create exports using the API by making a request to the specific endpoint.

  2. Export Status and Expiry: After a successful export creation, the exported data is stored for one day. The data is deleted from the API after this period, and the status of the export is updated to expired.

  3. Export Metadata and Data Retrieval: Users can retrieve metadata of a specific export and list export data using the respective GET endpoints. The export data retrieval process is paginated, involving multiple requests to access all files.

  4. Rate Limiting: The API has a rate limiting mechanism to control the number of requests per group within a specific time window. Rate limiting can be configured using parameters such as the number of requests permitted, the length of the fixed window, and the TTL for cache entries.

Exports API is organized around HTTP REST. Our API allows you to request CDRs as exports for specific time range. The maximum date range supported is two days. The smallest requested date range is one hour (for example, 2023-01-12T12:00:00.000Z to 2023-01-12T13:00:00.000Z).

Minutes/seconds/milliseconds will not change the export (example, 2023-01-12T12:00:00.000Z to 2023-01-12T13:00:00.000Z is equal to 2023-01-12T12:10:00.000Z to 2023-01-12T13:20:00.000Z).

Here are the key reasons for exporting data:

  • Retention Policy: Omilia enforces a 60-day retention policy; to prevent data loss, it is imperative to export and store the data in your individual database.

  • Flexible Data Transfer: Seamlessly transfer data to a library of your choice, ensuring immediate and unrestricted access for your specific requirements.

  • Custom Metric Development: Empower your analytics by creating personalized metrics tailored to your unique business needs, leveraging the exported data for comprehensive insights and reporting capabilities.

Each group can run one export at a time. After the successful creation of the export, the exported data is stored for one day, after this period the data is deleted from the API and the status of the export is updated to expired.

We use built-in HTTP authentication to validate users based on groups/roles stored in IAM.

Authentication

Navigate to the API Authentication to learn more about Authorization Token Endpoint and Authentication process.

Erros Codes

Omilia's HTTP response codes can be found on the HTTP Code Responses page.

Batch Export API Reference

{{baseUrl}} depends on the user's environment which could be the following:

EU1 - https://eu1-m.ocp.ai

US1 - https://us1-m.ocp.ai

US2 - https://us2-m.ocp.ai

US1W - https://us1-w-m.ocp.ai

Batch Export Sequence Diagram

export_api.drawio (2).png

Batch Export API sequence diagram

Exports Access Token Creation

The access token is a JWT generated by Omilia's IAM server that exports-api will use to validate the user against the same server and check user’s whitelist of groups.

Whitelisted groups should be added as attributes assigned to the user or to a group which the user belongs to.

After creating the user, the client should obtain access token from IAM server via its API.

Click to see the details

cURL Example Request

CODE
$ curl -v -X POST '{iam-url}/auth/realms/master/protocol/openid-connect/token' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer {access_token}' \
    --data-raw '{
      "username": "api_test_user1",
      "password": "omilia",
      "grant_type": "password",
      "client_id": "ocp"
    }'

Response

A successful request returns the HTTP 200 status code and a JSON response body that contains the access token to use with exports-api.

Create Export

POST

{{baseUrl}}/exports-api/v1/groups/{{group}}/jobs

Create batch export request to access raw application data through export.

Click to see the details
JSON
{
  "from_date": "2023-01-12T13:00:00.000Z",
  "to_date": "2023-01-12T14:00:00.000Z",
  "types": [
    "Dialog Data"
  ],
  "export_name": "Jan-12-2023-1300-Export"
}

Headers

Parameter

Type

Description

Content-Type

String

Set it to application/json.

Path Parameters

Property

Type

Required

Description

group

string

Yes

The group (organization) the export requested belong to.

Body Parameters

Property

Type

Required

Description

export_name

string

Yes

Name of specific export (^[a-zA-Z0-9-][a-zA-Z0-9-\\s]+$). The export name is selected by the exporter.

from_date

DateTime(UTC)

Yes

Timestamp before to_date (ISO-8601 format)

to_date

DateTime(UTC)

Yes

to_date must be at least two hours before export request time. from_date-to_date should be equal or less than two days. (ISO-8601 format)

types

array(string)

Yes

The types of data needed for export. Possible values:

  • ["Dialog Data"] {dialog_step + dialog_start + dialog_end + vb_enrolment + vb_verification + audit}

This is going to be deprecated in the later version of the Exports API.

  • ["ALL"] {dialog_step + dialog_start + dialog_end + vb_enrolment + vb_verification + audit}

  • ["Dialog Step","Dialog End","Dialog Start"]

Each one of these can be given independently.

These are going to be deprecated in the later version of the Exports API.

  • ["dialog_step","dialog_end","dialog_start","vb_enrolment","vb_verification","audit"]

Each one of these can be given independently.

Exports Supported

Currently the API supports only CDR exports. The CDRs now have 6 different types: dialog_start, dialog_step, dialog_end, vb_verification, vb_enrolment, audit. For more information regarding CDRs, please read the CDR Models Schema page. For more information regarding VB Models, please refer to the VB Models Schema page.

Response

A successful request returns the HTTP 200 status code and a JSON response body that shows the export id created (UUID) and a description field (String) with success.

Example

JSON
{
  "description": "Task Submitted",
  "export_id": "73bd903e-e5c5-4b87-a9a9-6a35e45af48f"
}

List Exports

GET

{{baseUrl}}/exports-api/v1/groups/{{group}}/jobs

Get a list of exports created through the API.

Click to see the details

Path Parameters

Property

Type

Required

Description

group

string

Yes

The group (organization) that the list export refers to.

Query Parameters

Property

Type

Required

Description

page_number

Integer

No

Integer > 0 , default value = 1

page_size

Integer

No

100 >= Integer > 0 , default value = 50

status

string

No

The types of data needed for export
Possible values:

  • SUBMITTED - the export request has been successfully submitted.

  • PROCESSING - the export request is being processed.

  • RUNNING -the export request is running to to fetch all the user requested data.

  • READY - the export is ready to be retrieved by the end user.

  • EXPIRED - the export is no longer available to be retrieved by the end user, so you need to create a new export request.
    (Each one of these can be given independently)

Response

A successful request returns the HTTP 200 status code and a JSON response body that shows a list of created exports from the specific group.

Example

JSON
{
    "pagination": {
        "pages": 1,
        "page_number": 1,
        "page_size": 2,
        "total_results": 2
    },
    "exports": [
        {
            "name": "KT_dw_qa_2_AwsDev",
            "status": "EXPIRED",
            "group": "dw_qa_2_AwsDev",
            "export_id": "3342d2f8-2279-43a3-b4e9-082ceed19a68",
            "time_submitted": "2023-01-13T09:54:58.192Z",
            "from_date": "2023-01-13T05:00:00Z",
            "finished_date": "2023-01-13T09:55:50.57Z",
            "to_date": "2023-01-13T06:00:00Z",
            "types": [
                "Dialog Step",
                "Dialog Start",
                "Dialog End"
            ]
        },
        {
            "name": "tests",
            "status": "EXPIRED",
            "group": "dw_qa_2_AwsDev",
            "export_id": "b52d8a2c-358f-486d-a464-f89dbf2eaa9b",
            "time_submitted": "2023-01-05T12:19:54.061727Z",
            "from_date": "2022-12-05T00:00:00Z",
            "finished_date": "2023-01-08T18:00:01.784466Z",
            "to_date": "2022-12-05T23:00:00Z",
            "types": [
                "Dialog Step"
            ]
        }
    ]
}

Get Export Metadata

In order to GET export data, exports must be in status READY.

GET

{{baseUrl}}/exports-api/v1/groups/{{group}}/jobs/{{export_id}}

Get the metadata of a specific export, using the export_id retrieved either from the Create Export (at the time of creation) or the List Exports API.

Click to see the details

Path Parameters

Property

Type

Required

Description

group

string

Yes

The group (organization) that the list export refers to.

export_id

UUID string

Yes

A valid UUID string referencing a created export.

Response

A successful request returns the HTTP 200 status code and a JSON response body that shows metadata of the specific export.

Example

JSON
{
  "export_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "num_of_files": 0,
  "size_of_export": 0
}

List Export Data

In order to GET export data, exports must be in the READY status.

GET

{{baseUrl}}/exports-api/v1/groups/{{group}}/jobs/{{export_id}}/data/compressed

Retrieve the export files (raw application data) by export_id in a compressed (zipped) format using pagination.

Click to see the details

Path Parameters

Property

Type

Required

Description

group

string

Yes

The group (organization) that the list export refers to.

export_id

UUID string

Yes

A valid UUID string referencing a created export.

Query Parameters

Property

Type

Required

Description

page_number

Integer

No

Integer > 0, default value 1

page_size

Integer

No

50 >= Integer > 0, default value 20

To acquire the data from an export containing several files (information on the number can be found in the "Get Export Metadata" endpoint response body, or the response headers of the "List response data" endpoint), there are several approaches.

For example:

For an export containing 160 files, you can either access the specific endpoint 8 times, utilizing the default page size of 20 and incrementing the page number by 1 with each request (ranging from 1 to 8), or you can access the endpoint 4 times, using a page size of 50 and advancing sequentially from page numbers 1 to 4.

Essentially, what this means, is that the export process is paginated and consequently, it involves making multiple requests.

Response

A successful request returns the HTTP 200 status code with pagination HTTP headers and initiates a streaming response that when finished, a zip file is created and downloaded.

The HTTP headers you will be dealing with involve the following:

  • Pagination-pages: This refers to the total number of accessible pages.

  • Pagination-page_number: Indicates the specific page you're getting.

  • Pagination-page_size: This represents the quantity of files downloaded with this request.

For the Batch Export, it’s possible to download a maximum of 5 ZIP files within a minute. Otherwise, the downloading process will hit rate limiting.

Example

example.png

More info regarding the ZIP file and the information contained can be found in Export Service User Guide and CDR Models Schema.

Streaming Export (Subscriptions) API Reference

Subscription functionality within the Export Service of Omilia OCP® empowers users to subscribe to message channels, facilitating the receipt of near real-time data streams. Read more about how to use subscriptions in the Export Service User Guide.

To get access to Export Subscriptions, please contact your Account Manager.

Streaming Exports API allows clients to subscribe to message channels and receive streams of data in a near real-time manner. The message channels are organized by data type. Currently, the following data types are supported:

  • Dialog data

    • dialog_start

    • dialog_end

    • dialog_step

  • Audit data

    • audit_events

  • VB data

    • vb_verification

    • vb_enrolment

Streaming Exports API is organized around HTTP REST for the management of the subscriptions. Although it aims to support multiple delivery methods, currently the streams are delivered via HTTP requests sent to the client’s public API gateway.

Each group is allowed to have only one running streaming export at a time for each message type (for example, dialog_step, dialog_start). After the successful creation of the export, the data starts streaming in the clients provided callback path.

We use built-in HTTP authentication to validate users based on groups/roles stored in IAM.

Currently Audit_events may be available on particular environment. Reach out to your Account Manager for more details.

Streaming Export Sequence Diagram

streaming_export_api-new.svg

Exports Access Token Creation

The access token is a JWT generated by Omilia's IAM server that exports-api will use to validate the user against the same server and check user’s whitelist of groups.

Whitelisted groups should be added as attributes assigned to the user or to a group which the user belongs to.

After creating the user, the client should obtain access token from IAM server via its API.

Click to see the details

cURL Example Request

CODE
$ curl -v -X POST '{iam-url}/auth/realms/master/protocol/openid-connect/token' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer {access_token}' \
    --data-raw '{
      "username": "api_test_user1",
      "password": "omilia",
      "grant_type": "password",
      "client_id": "ocp"
    }'

Response

A successful request returns the HTTP 200 status code and a JSON response body that contains the access token to use with exports-api.

Create Streaming Export

POST

{{baseUrl}}/exports-api/v1/groups/{{group}}/subscriptions

Create a streaming export subscription to start the process of real-time streaming of raw application data to the client provided callback path.

Click to see the details
JSON
{
      "data_type": "dialog_start",
      "schema_name":"my_ocp_start_cdrs",
      "delivery":{
            "type": "http",
            "path": "http://wiremock_wiremock:8080/wiremock/data",
            "auth_type": "oauth2",
            "auth_id": "test-*****",
            "auth_secret": "BLdnUUDbtgy0YdFdN*****",
            "token_path": "https://aws-dev-m.ocp.ai/auth/realms/master/protocol/openid-connect/token",
            "auth_scope": "scopeValue",
            "custom_headers": {
                "x-test-header-test1": "value1",
                "x-test-header-test2": "value2"
            }
      }
}

Path Parameters

Property

Type

Required

Description

group

string

Yes

The group (organization) the export requested belong to. Possible values:"dw_qa_AwsDev"

Body Parameters

Property

Type

Required

Description

data_type

string

Yes

The type of specific subscription (for example, dialog_start, dialog_step, dialog_end, audit, vb_enrolment, vb_verification). The data types are different on each environment and will be a subset of the examples given above.

schema_name

string

Yes

The schema name used for outbound calls (for example, ocp_cdr_start, ocp_cdr_end, my_ocp_start_cdrs).

delivery

object

Yes

The information delivery.

type

string

Yes

http, https

path

string

Yes

The callback path, the customer will get the data to

auth_type

string

Yes

oauth2.

auth_id

string

Yes

The user id used to retrieve oauth2 jwt token from client.

auth_secret

string

Yes

The user secret used to retrieve token from client.

token_path

string

Yes

The user’s URI to use in order to get the token.

auth_scope

string

No

The clients custom scope that will be used when requesting an oauth2 token. The length of this field is limited to 100 characters. The value should contain only valid ASCII printable characters.

custom_headers

Map<String,String>

No

The client can enrich this map with the custom headers that need to be sent in the customer API alongside with the customer's data. The headers need to abide to the following rules:

  • HTTP header key starts with x- (not case-sensitive);

  • HTTP header key does not start with x-ocp (not case-sensitive);

  • HTTP header key contains only alphanumerics, slash and hyphens;

  • HTTP header value is not null;

  • HTTP header value length is less than 1000;

  • HTTP header value contains only ASCII printable characters.

The number of custom headers to be set from the client is limited to 5.

Response

A successful request returns the HTTP 200 status code and a JSON response body that shows the streaming export id created (UUID) and a description field (String) with success.

Example

JSON
{
    "description": "Streaming subscription Submitted",
    "export_id": "c545eaac-dad5-44fc-8d6c-77db67cc5235"
}

Create Subscription cURL Example Request

CODE
curl --location '{{baseUrl}}/exports-api/v1/groups/{group}/subscriptions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {access_token}' \
--data '{
            "data_type": "dialog_start",
            "schema_name":"my_ocp_start_cdrs",
                "delivery":{
                    "type": "https",
                    "path": "https://randomclientsapipath.com/wewaitfordata",
                    "auth_type": "oauth2",
                    "auth_id": "dummyid",
                    "auth_secret": : "my_auth_secret",
                    "token_path": "get_authentication",
                    "auth_scope": "scopeValue",
                    "custom_headers": {
                        "x-test-header-test1": "value1",
                        "x-test-header-test2": "value2"
                    }
                }
}'

List Streaming Exports Subscriptions

GET

{{baseUrl}}/exports-api/v1/groups/{{group}}/subscriptions

List of current active streaming export subscriptions created by the client.

Click to see the details

Path Parameters

Property

Type

Required

Description

group

string

Yes

The group (organization) that the list export refers to. Possible values:

  •  "dw_qa_1_AwsDev"

Query Parameters

Property

Type

Required

Description

page_number

Integer

No

Integer > 0 , default value = 1

page_size

Integer

No

100 >= Integer > 0 , default value = 50

Response

A successful request returns the HTTP 200 status code and a JSON response body that shows a list of created streaming exports subscriptions from the specific group.

Example

JSON
{
    "pagination": {
        "pages": 1,
        "page_number": 1,
        "page_size": 4,
        "total_results": 4
    },
    "exports": [
        {
            "data_type": "dialog_step",
            "schema_name": "my_ocp_dialog_step",
            "created_at": "2024-01-08T12:47:12.268328Z",
            "subscription_id": "c545eaac-dad5-44fc-8d6c-77db67cc5235",
            "delivery": {
                "type": "http",
                "path": "http://wiremock_wiremock:8080/dw_qa_1_AwsDev/data"
            }
        },
        {
            "data_type": "dialog_end",
            "schema_name": "my_ocp_dialog_end",
            "created_at": "2024-01-08T12:47:12.268328Z",
            "subscription_id": "6e0dc618-01e5-4f7e-a91a-8ad01eb26355",
            "delivery": {
                "type": "http",
                "path": "http://wiremock_wiremock:8080/dw_qa_1_AwsDev/data"
            }
        },
        {
            "data_type": "dialog_start",
            "schema_name": "my_ocp_dialog_start_random_name",
            "created_at": "2024-01-08T12:47:12.268328Z",
            "subscription_id": "a59a3b0f-4d20-432c-9766-d87ab77b1410",
            "delivery": {
                "type": "http",
                "path": "http://wiremock_wiremock:8080/dw_qa_1_AwsDev/data"
            }
        },
        {
            "data_type": "vb_verification", 
            "schema_name": "my_ocp_vb_verification_random_name", 
            "created_at": "2024-07-08T14:47:12.268328Z", 
            "subscription_id": "b23d440f-f825-4d3d-9d0b-a77be04f3fd5", 
            "delivery": { 
                "type": "http", 
                "path": "http://wiremock_wiremock:8080/dw_qa_1_AwsDev/data"
            } 
        }
    ]
}

Delete Subscriptions by ID

DELETE

{{baseUrl}}/exports-api/v1/groups/{{group}}/subscriptions/{{export_id}}

Deletes streaming export subscriptions by ID.

Click to see the details

Path Parameters

Property

Type

Required

Description

group

string

Yes

The group (organization) that the list export refers to. Possible values:

  •  dw_qa_1_AwsDev

export_id

uuid

Yes

The export_id to be deleted. Possible values:

  •  2b177cb4-5229-4c90-8640-e0b9bfdc22

Response

A successful request returns the HTTP 200 status code and a JSON response body with a message success.

Example

JSON
{
    "message": "success"
}

Examples of Streaming Export JSON Object Provided to Clients

Here are some examples of the data that the client will start receiving after successfully creating a streaming exports subscription.

The events have the corresponding subscription type inside messages. In this example, the type is the start of the CDRs JSON files, whilst "my_ocp_start_cdrs" is the name selected for the export subscription.

JSON
{
    "schemaName": "my_ocp_start_cdrs",
    "sessionId": "5c2b9dc1-899a-4124-97f5-b7e3e02a0660",
    "sessionStartingSequenceNumber": "0",
    "messages": [
        {
            "app": 
                ...
                "message_type": "dialog_start",
                ...
           },
            {
             ...
            },...
        ]
}

The API expects a valid JSON Object response from the client API.

In the second example containing VB data, the type is the start of the CDRs JSON files, whilst "my_ocp_vb_verification" is the name selected for the export subscription.

JSON
{
    "schemaName": "my_ocp_vb_verification",
    "sessionId": "5c2b9dc1-899a-4124-97f5-b7e3e02a0660",
    "sessionStartingSequenceNumber": "0",
    "messages": [
        {
            "app": 
                ...
                "message_type": "vb_verification",
                ...
           },
            {
             ...
            },...
        ]
}

The API expects a valid JSON Object response from the client API.

Reconciliation Process

Exports API offers a reconciliation process for messages that were dropped due to customer's API unavailability or other kind of failures.

Reconciliation process can fetch up to 24 hours of data, meaning it can run even if the client’s API is down for up to 24 hours. The reconciliation mechanism is being triggered automatically, approximately within 10 minutes, after the clients API is back online.

The reconciliation process will run on the background to fetch older data, while the stream continues to send newly generated data. Newly generated data is handled with priority over older data, but the streams of old and new data run in parallel. The reconciliation time may vary depending on both the current stream load and the amount of older data that needs to process, bounded by client’s API rate limiting requirements.

For cases when the client's API was down more than 24 hours, we recommend using the batch process to fetch older data.

Rate Limiting

Exports API has a rate limiting mechanism configured by its configuration file, which applies a threshold of requests per group for a specific time window. The algorithm used is a token-bucket applied over a fixed window of time. This means that for a specific window, a certain amount of tokens are produced for each group and they’re consumed as requests are landing on each endpoint.

One limit per group applies for all endpoints. If the limit is exceeded, the API will respond with an error response of Status Code 429 (Too many requests). The API will again allow requests for this group after the bucket refills with tokens in the next fixed request window.

For the Batch Export, it’s possible to download a maximum of 5 ZIP files within a minute. Otherwise, the downloading process will hit rate limiting.

The status of the buckets is kept in a memory cache. In order to prevent the cache from growing indefinitely, there is a Time To Live (TTL) for each entry. Entries will be evicted if the TTL of the entry is exceeded (the configured TTL value should be more than the request window).

After eviction, a new cache entry will be created if a new request arrives.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.