Unomi Studio

Dashboard to manage apache unomi, unomi studio provides options with both dashboard and rest api to manage customer data platform smart.

Getting started

Supported

  • Apache Unomi : 1.5.6
  • Elastic Search: 7.4.2

Prerequisites

  • Docker
  • Docker Compose

Docker Way

docker-compose build
docker-compose up -d

Wait till unomi docker container is up and running

cd scripts
./post-deploy-script.sh

TroubleShooting

  • Sometimes unomi-studio may boot up earlier than elasticsearch and unomi, in such cases wait till other containers are booted and restart unomi-studio containers.
  • After running the script, unomi may take 15 to 20 mins to update the geo database, so in such cases apache unomi may not respond.

UI

Run following url in browser

http://localhost:8085

For ssl

https://localhost:8445

Tenant View

tenants

Apps View

apps

Dashboard View

dashboard

SSL

Replace the certificate under sslcert folder to pick up the latest certs

Steps to create self signed certificates

openssl genrsa -out key.pem
openssl req -new -key key.pem -out csr.pem
openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem
rm csr.pem

Rest

Unomi studio exposes api and ui

Base Path: http://localhost:8085/v1/api

API

Tenants

List of apis to create tenants under customer data platform, all the apps, session, events will be mapped under tenant

Register Tenant

Register new tenant to application

URL

{basepath}/tenants/register

METHOD

POST

REQUEST

{
    "name" : "" //string
}

RESPONSE

{
    "success": true, //boolean
    "status": 201,    // number
    "data": "Tenant is already registered" // string
}
Possible Status Codes Description
201 Success, tenant is created
409 Tenant is already registered
400 Failed to create tenant

CURL

curl --location --request POST '{basepath}/tenants' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name" : ""
}'

Get All Tenants

Returns all registered tenants

URL

{basepath}/tenants

METHOD

GET

RESPONSE

{
    "success": true, // boolean
    "status": 200, // number
    "data": [     // string array
        ""
    ]
}
Possible Status Codes Description
201 Success
404 No Tenants available
400 Invalid request

CURL

curl --location --request GET '{basepath}/tenants' 

Get Tenant

Returns particular tenant with list of apps attached to tenant

URL

{basepath}/tenants/{tenantname}

METHOD

GET

RESPONSE

{
    "success": true, //boolean
    "status": 200, //number
    "data": {
        "name": "tenantName", //string
        "apps": [
            {
                "apiKey": "XXXXXXXXXXX", //string
                "appName": "appName" //string
            }
        ]
    }
}
Possible Status Codes Description
201 Success
404 No Tenant available
400 Invalid request

CURL

curl --location --request GET '{basepath}/tenants/{tenantname}' 

Delete Tenant

Deletes tenant

URL

{basepath}/tenants/{tenantname}

METHOD

DELETE

RESPONSE

{
    "success": true, //boolean
    "status": 200, //number
    "data": "Tenant Deleted Successfully"
}
Possible Status Codes Description
201 Success
404 No Tenant available
400 Invalid request

CURL

curl --location --request DELETE '{basepath}/tenants/{tenantname}' 

Register App

Register new app to the tenant passed in path of url request

URL

{basepath}/tenants/{tenantname}/apps/register

METHOD

POST

REQUEST

{
    "appName" : "" //string
}

RESPONSE

{
    "success": true, //boolean
    "status": 201,    // number
    "data": "created" // string
}
Possible Status Codes Description
201 Success, app is created
409 App is already registered
404 Tenant is not available, try to register tenant first
400 Failed to create app

CURL

curl --location --request POST '{basepath}/tenants/{tenantname}/apps/register' \
--header 'Content-Type: application/json' \
--data-raw '{
    "appName" : "appName"
}'

Get All Apps

Returns all apps of the tenant

URL

{basepath}/tenants/{tenantname}/apps

METHOD

GET

RESPONSE

{
    "success": true, //boolean
    "status": 200, //number
    "data": [
            {
                "apiKey": "XXXXXXXXXXX", //string
                "appName": "appName" //string
            }
    ]
}
Possible Status Codes Description
201 Success
404 No Tenant available
400 Invalid request

CURL

curl --location --request GET '{basepath}/tenants/{tenantname}/apps' 

Get App Visits

Returns all apps of the tenant

URL

{basepath}/tenants/{tenantname}/apps/visits

METHOD

GET

QUERY PARAM

range: last-7 | last-30 | today || default last-7

RESPONSE

{
    "success": true,
    "status": 200,
    "data": {
        "totalAppVisits": 0,
        "apps": [
            {
                "appName": "iski",
                "visits": 0
            }
        ]
    }
}
Possible Status Codes Description
201 Success
404 No Tenant available
400 Invalid request

CURL

curl --location --request GET '{basepath}/tenants/{tenantname}/apps/visits' 

Delete App

Deletes the app under the tenant

URL

{basepath}/tenants/{tenantname}/apps

METHOD

DELETE

HEADERS (Required)

apikey: *****

REQUEST

{
    "appName" : "" //string
}

RESPONSE

{
    "success": true, //boolean
    "status": 200, //number
    "data": "deleted" //string
}
Possible Status Codes Description
201 Success
404 No Tenant or No App available
401 Missing apikey
400 Invalid request

CURL

curl --location --request DELETE '{basepath}/tenants/{tenantname}/apps' \
--header 'apikey: {apiKey} ' \
--data-raw '{
    "appName" : "appName"
}'

Sessions

Sessions are created when user visited for the first time

Count

Return total count of sessions created under an app

URL

{basepath}/sessions/count

METHOD

GET

QUERY PARAM

range: last-7 | last-30 | today || default last-7

HEADERS (Required)

apikey: *****

RESPONSE

{
    "success": true, //boolean
    "status": 200, //number
    "data": 1 //number
}
Possible Status Codes Description
200 Success
404 No Tenant or No App available
401 Missing or Invalid apikey
400 Invalid request

CURL

curl --location --request GET '{basepath}/sessions/count' \
--header 'apikey: ********'

Get Profile Session

Get list of sessions associated to profile

URL

{basepath}/sessions/profile/{profileid}

METHOD

GET

HEADERS (Required)

apikey: *****

RESPONSE

{
    "success": true,
    "status": 200,
    "data": {
        "list": [
            {
                "itemId": "92eaed85-9821-5b07-b4d8-546e77d3132b",
                "itemType": "session",
                "scope": "",
                "version": 2,
                "profileId": "",
                "profile": {
                    "itemId": "",
                    "itemType": "profile",
                    "version": null,
                    "properties": {
                        "nbOfVisits": 1,
                        "lastVisit": "",
                        "firstVisit": ""
                    },
                    "systemProperties": {
                        "lastUpdated": ""
                    },
                    "segments": [],
                    "scores": {},
                    "mergedWith": null,
                    "consents": {}
                },
                "properties": {
                },
                "systemProperties": {},
                "timeStamp": "",
                "lastEventDate": "",
                "size": 2,
                "duration": 7841
            }
        ],
        "offset": 0,
        "pageSize": 50,
        "totalSize": 1,
        "totalSizeRelation": "EQUAL",
        "scrollIdentifier": null,
        "scrollTimeValidity": null
    }
}
Possible Status Codes Description
200 Success
404 No Tenant or No App available
401 Missing or Invalid apikey
400 Invalid request

CURL

curl --location --request GET '{basepath}/sessions/profile/{profileid}' \
--header 'apikey: ************' 

Get Session

Get detailed session

URL

{basepath}/sessions/{sessionid}

METHOD

GET

HEADERS (Required)

apikey: *****

RESPONSE

{
    "success": true,
    "status": 200,
    "data": {
        "itemId": "92eaed85-9821-5b07-b4d8-546e77d3132b",
        "itemType": "session",
        "scope": "",
        "version": 2,
        "profileId": "517f7ee3-88a5-4977-812a-813db0b2006b",
        "profile": {
            "itemId": "517f7ee3-88a5-4977-812a-813db0b2006b",
            "itemType": "profile",
            "version": null,
            "properties": {
                "nbOfVisits": 1,
                "lastVisit": "2021-05-24T10:00:35Z",
                "firstVisit": "2021-05-24T10:00:34Z"
            },
            "systemProperties": {
                "lastUpdated": "2021-05-24T10:00:35Z"
            },
            "segments": [],
            "scores": {},
            "mergedWith": null,
            "consents": {}
        },
        "properties": {
        },
        "systemProperties": {},
        "timeStamp": "2021-05-24T10:00:34Z",
        "lastEventDate": "2021-05-24T10:00:41Z",
        "size": 2,
        "duration": 7841
    }
}
Possible Status Codes Description
200 Success
404 No Tenant or No App available
401 Missing or Invalid apikey
400 Invalid request

CURL

curl --location --request GET '{basepath}/sessions/{sessionid}' \
--header 'apikey: ************'

Aggregate

Get aggregated count of events based on type passed, check the options section on available options

URL

{basepath}/sessions/aggregate/{type}

METHOD

GET

QUERY PARAM

range: last-7 | last-30 | today || default last-7

OPTIONS

Session Aggregate Types Description
DeviceCategory Returns list of devices the sessions are created
Browser Returns list of browser the sessions are created
DeviceBrand Returns list of device the applications are consumed
Visits Returns the total number of visits to application
LiveTime Returns maximum session time that a user is in application
Country Returns country based visit details

HEADERS (Required)

apikey: *****

RESPONSE

{
    "success": true,
    "status": 200,
    "data": {
        "total":5
    }
}
Possible Status Codes Description
200 Success
404 No Tenant or No App available
401 Missing or Invalid apikey
204 No Content
400 Invalid request

CURL

curl --location --request GET '{basepath}/sessions/aggregate/{type}' \
--header 'apikey: ************'

Profiles

Profiles are users who visited the application

Get Profiles

Get profiles who visited the application

URL

{basepath}/profiles

METHOD

GET

HEADERS (Required)

apikey: *****

QUERY PARAM

limit: 10 || default 100
offset: 1 || default 0
range: last-7 | last-30 | today || default last-7

RESPONSE

{
    "success": true,
    "status": 200,
    "data": {
        "list": [],
        "offset": 0,
        "pageSize": 10,
        "totalSize": 0,
        "totalSizeRelation": "EQUAL",
        "scrollIdentifier": null,
        "scrollTimeValidity": null
    }
}
Possible Status Codes Description
200 Success
404 No Tenant or No App available
401 Missing or Invalid apikey
400 Invalid request

CURL

curl --location --request GET '{basepath}/profiles' \
--header 'apikey: ************'

Count

Get total count of profiles

URL

{basepath}/profiles/count

METHOD

GET

QUERY PARAM

range: last-7 | last-30 | today || default last-7

HEADERS (Required)

apikey: *****

RESPONSE

{
    "success": true,
    "status": 200,
    "data": 0
}
Possible Status Codes Description
200 Success
404 No Tenant or No App available
401 Missing or Invalid apikey
400 Invalid request

CURL

curl --location --request GET '{basepath}/profiles/count' \
--header 'apikey: ************'

Total Visits

Get total visits by users

URL

{basepath}/profiles/visits

METHOD

GET

QUERY PARAM

range: last-7 | last-30 | today || default last-7

HEADERS (Required)

apikey: *****

RESPONSE

{
    "success": true,
    "status": 200,
    "data": 0
}
Possible Status Codes Description
200 Success
404 No Tenant or No App available
401 Missing or Invalid apikey
400 Invalid request

CURL

curl --location --request GET '{basepath}/profiles/visits' \
--header 'apikey: ************'

Get Profile

Get user details

URL

{basepath}/profiles/{profileid}

METHOD

GET

HEADERS (Required)

apikey: *****

RESPONSE

{
    "success": true,
    "status": 200,
    "data": {
        "itemId": "517f7ee3-88a5-4977-812a-813db0b2006b",
        "itemType": "profile",
        "version": 1,
        "properties": {
            "nbOfVisits": 1,
            "lastVisit": "2021-05-24T10:00:35Z",
            "firstVisit": "2021-05-24T10:00:34Z"
        },
        "systemProperties": {
            "lastUpdated": "2021-05-24T10:00:35Z"
        },
        "segments": [],
        "scores": {},
        "mergedWith": null,
        "consents": {}
    }
}
Possible Status Codes Description
200 Success
404 No Tenant or No App available
401 Missing or Invalid apikey
204 No Content
400 Invalid request

CURL

curl --location --request GET '{basepath}/profiles/{profileid}' \
--header 'apikey: ************'

Events

List of apis to retrieve events that are generated by application

Get Events

Get events of apps

URL

{basepath}/events

METHOD

GET

QUERY PARAM

limit: 10 || default 100
offset: 1 || default 0
range: last-7 | last-30 | today || default last-7
eventtype: (optional)

HEADERS (Required)

apikey: *****

RESPONSE

{
    "success": true,
    "status": 200,
    "data": {
        "list": [],
        "offset": 0,
        "pageSize": 10,
        "totalSize": 0,
        "totalSizeRelation": "EQUAL",
        "scrollIdentifier": null,
        "scrollTimeValidity": null
    }
}
Possible Status Codes Description
200 Success
404 No Tenant or No App available
401 Missing or Invalid apikey
204 No Content
400 Invalid request

CURL

curl --location --request GET '{basepath}/events' \
--header 'apikey: ************'

Count

Get count events of raised for apps

URL

{basepath}/events/count

METHOD

GET

QUERY PARAM

range: last-7 | last-30 | today || default last-7

HEADERS (Required)

apikey: *****

RESPONSE

{
    "success": true,
    "status": 200,
    "data": 0
}
Possible Status Codes Description
200 Success
404 No Tenant or No App available
401 Missing or Invalid apikey
204 No Content
400 Invalid request

CURL

curl --location --request GET '{basepath}/events/count' \
--header 'apikey: ************'

Aggregate

Get aggregated count of events based on type passed, check the options section on available options

URL

{basepath}/events/aggregate/{type}

METHOD

GET

QUERY PARAM

range: last-7 | last-30 | today || default last-7

OPTIONS

Event Aggregate Types Description
EventType Returns aggregated events based on the event type

HEADERS (Required)

apikey: *****

RESPONSE

{
    "success": true,
    "status": 200,
    "data": {
        "total":5,
        "view" :3,
        "sessionCreated": 2
    }
}
Possible Status Codes Description
200 Success
404 No Tenant or No App available
401 Missing or Invalid apikey
204 No Content
400 Invalid request

CURL

curl --location --request GET '{basepath}/events/aggregate/{type}' \
--header 'apikey: ************'