This site contains only USER GUIDES. Looking for ADMIN content? Login here at help-auth.eleveo.com
Eleveo Cloud Native

Custom Import of Historical Data Using API

Overview

As an alternative to using Eleveo Data Importers, historical data can be imported using the provided API. This page describes the API, its endpoints, and usage examples.

The API requires authentication. As a result, uploading historical data to WFM consists of two steps:

  1. Requesting and getting an authentication token.

  2. Uploading the token and data to the API.

Prerequisites

As a prerequisite, the Provider Client must be added in User Management. Follow the procedure described on the Managing Provider Clients page and note the Client ID and Secret values – they are required when requesting the token.

The same Provider Client can be used for Custom Import of Adherence Data Using API.

API Endpoints

The following API endpoints exist:

  • Get Access Token: http://<host>:<port>/auth/realms/<tenant>/protocol/openid-connect/token where:

    • <host> is an address or a name of the server where WFM is running.

    • <port> is a port opened on the server where WFM is running.

    • <tenant> is the name of the realm (if not sure what the tenant name is, check the URL of the Eleveo applications: <tenant>.myeleveo.com).

  • Send historical data to WFM: http://<tenant>.<host>:<port>/_rest/forecasting/historical-data/historical-data-push where:

    • <host> is an address or a name of the server where WFM is running.

    • <port> is a port opened on the server where WFM is running.

    • <tenant> is the name of the realm (if not sure what the tenant name is, check the URL of the Eleveo applications: <tenant>.myeleveo.com).

Requesting and Getting the Token

The table below shows an example HTTP request with the relevant header attributes and body for obtaining an access token. Replace the example parameter values with the relevant settings. Use a third-party application or the curl command to send the request.

Action

HTTP Method

Endpoint

Header

Body

Get Access Token

POST

http://<host>:<port>/auth/realms/<tenant>/protocol/openid-connect/token

Content-Type: application/x-www-form-urlencoded

{

grant_type: client_credentials

client_id: <Client ID from Client Provider in User Management>

client_secret: <Secret from Client Provider in User Management>}

Sample response:

"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJXUzRxalJCZmUxRk4xa3UxakszcWpNS1pQQUJHNzdIQzBwSXlISXgxc0tRIn0.eyJqdGkiOiIyMDMzMWRjMi00NmZlLTQxMjQtYWZmZS0yYzllNWFmMGFjYzQiLCJleHAiOjE1OTAxMzUyNjUsIm5iZiI6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VVRSIsIldGTV9DUkVBVEVfUVVFVUUiXX0sIndmbS1mb3JlY2FzdGluZy1hcHAiOnsicm9sZXMiOlsiV0ZNX0RFTEVURV9GT1JFQ0FTVCIsIldGTV9ISVNUT1JJQ0FMX0RBVEFfUFVTSCIsIldGTV9DUkVBVEVfRk9SRUNBU1QiLCJXRk1fVklFV19GT1JFQ0FTVCIsIldGTV9FRElUX0ZPUkVDQVNUIiwiV0ZNX0ZJTEVfVVBMT0FEIl19fSwic2NvcGUiOiJlbWFpbCBwcm9maWxlIn0.03-IhDoWsXfBCkmj1l6rv7U9XNBu_vw2zpirrEPnxPc",
    "token_type": "bearer",
    "not-before-policy": 0,
    "session_state": "64624ee7-69fe-4a12-9ccc-f75cfbc11cb9",
    "scope": "email profile"

Uploading Data to WFM

Data can be uploaded in two ways:

  • as a single request

  • as a chunked request

Single Request

When a small amount of data is sent to WFM (for example, an incremental upload), data can be sent in one request. In such a case, set the query parameters:

  • pushToken: A unique identifier of the operation (UUID), generated as described on Wikipedia: Universally Unique Identifier

  • source: The name of the ACD from which data is uploaded.

  • lastChunk: A flag that identifies if the chunk is the last in the sequence. For a single request, set this to true.

The import is considered complete (and displayed in the import history list on the Data Import screen) after the request with the lastChunk=true parameter is sent.

Chunked Request

When a large amount of data is sent to WFM (mainly in the initial or as a full upload), it is better to split one big upload action into smaller requests/chunks. Divide the data into several parts to send them in separate requests. Set the parameters of the requests in the following way:

  1. All chunks related to the same upload operation have the same pushToken and source parameters (chunks of one upload request are identified based on the pushToken query parameter).

  2. The lastChunk parameter equals true only in the last chunk in the sequence. In all other chunks, it is set to false.

The import is considered complete (and is displayed in the import history list on the Data Import screen) after the request with the lastChunk=true parameter is sent.

API Definition

Use a third-party application or the curl command to send a request. Include the token obtained in the previous step.

Action

HTTP Method

Endpoint

Header

Query parameters

Body

Historical Data Push

POST

http://<tenant>.<host>:<port>/_rest/forecasting/historical-data/historical-data-push

Content-Type: text/csv

Tenant-ID: <name of the realm>

Authorization: Bearer <token received in the previous step>

pushToken: unique identifier of the operation (UUID) for each upload

sourceId: name of the ACD from which data is uploaded

lastChunk: flag that identifies if the chunk is the last in the sequence

historicalDataInterval: (optional) the length of the interval between values in the CSV file in seconds; possible values are: 900, 1800, 3600, 7200, etc. (multiples of 15 minutes); if nothing is specified, the default value of 900 seconds (15 minutes) is used.

Body text is an input stream with a specific file format, as described on the File Format page, for example:

2021-09-02_11-52-14.jpg

Historical data must cover the whole day from 00:00 to 24:00 in 15-minute intervals, even if values for some intervals are zero. If any gaps exist, data is uploaded but forecast creation based on that data fails.