Hi James,
The following information will help!
How is a client connected to the admin API authenticated?
- Use the following link to authenticate:
https://{ServerHostName}{:port}/{context}/html/en/default/admin/verify.jsp
- Use the following cURL example to connect. The -o flag is required to pass the unwanted HTTP output to a file, and the -c flag is used to capture the cookie response in a file.
curl -X POST 'https://{ServerHostName}{:port}/{context}/html/en/default/admin/verify.jsp' \
-F 'objectId=1000' -F 'actionId=1002' \
-F 'USERNAME=adminuser' -F 'PASSWORD=password' \
-o not-needed -c cookies.txt
- The cookie.txt file will have a similar context as below once you have authenticated successfully:
#HttpOnly_tririga.tririga.com FALSE / TRUE 0 JSESSIONID 0000fkHpsCkqg8CBoHeBzUnsvuM:7a7325e7-d40a-40b9-8418-cffcf0304a8d
How is authentication/authorization passed to API calls?
- Once you have authenticated and have the JSESSIONID cookie from the cookie.txt file, you can invoke the Admin APIs using the cURL commands below by using the cookie directly in the command line. You could also use the generated cookie.txt file by replacing the cookie header with -b cookie.txt
curl -i -H "Accept: application/json" -H "Cookie: JSESSIONID=00002j_c1AB635jTCI42tTyi6oC:7a7325e7-d40a-40b9-8418-cffcf0304a8d" \
'https://{ServerHostName}{:port}/{context}/api/V1/admin/summary'
- The API above will give you an output like this:
{
"operatingSytem": "Linux amd64 null",
"noofcpus": 4,
"baseApplicationServer": "Liberty",
"users": "3 users online",
"network": [
"linux xx.xx.xx.xx"
],
"javaVersion": "IBM Corporation 1.8.0_211",
"usedMemory": "1817 MB",
"freeMemory": "2125 MB",
"totalMemory": "3942 MB",
"maxMemory": "4096 MB",
"freeDiskSpace": "48081 MB",
"freeTempSpace": "48081 MB",
"tririgaBuildNumber": "296623",
"databaseBuildNumber": 296623,
"tririgaPlatformRelease": "3.8.0",
"moduleLevelAssociation": "Not Enabled",
"databaseConnection": "jdbc:db2://xxxx:50006/xxxx",
"outgoingMailServer": "\"\"",
"bravaServer": "Not Enabled",
"crystalRas": "${crystal.hostname}",
"internalCrystalRequestServer": "xx.xx.xx.xx:34891",
"configuredforSso": "N",
"baseCurrency": "US Dollars",
"timeForPortalToRefresh": "60",
"javaProcessIdOnHost": 4455443
}
- Another example could be related to the KPIs:
curl -i -H "Accept: application/json" -H "Cookie: JSESSIONID=00002j_c1AB635jTCI42tTyi6oC:7a7325e7-d40a-40b9-8418-cffcf0304a8d" \
'https://{ServerHostName}{:port}/{context}/api/V1/admin/performance/kpi'
- The KPI command above will give you an output like this:
{
"Java Memory (Used/Free/Total):": "2231/1711/3942",
"Logged In User Count:": 3,
"Total Workflows Completed:": 160372,
"Extended Formula Queue Count:": 0,
"Java use of CPU (%): ": "2%",
"Total Workflows Started:": 160372,
"Cache Info (Hits/Object Count/Misses/Ratio):": "66189331/6578/140980/2,043%",
"Workflow Events Throughput per 1 minutes:": 6,
"Total Workflows Failed:": 0,
"Active Database Connections:": 4,
"Workflow Events Queue Count:": 0,
"Total Workflow Steps Processed:": 1762817
}
This should help you get started! Let me know if you need any additional input.
Regards!
------------------------------
Shashank Agarwal
------------------------------
Original Message:
Sent: Fri January 06, 2023 10:06 AM
From: James Combs
Subject: Admin REST API information
I am seeking any java sample code (or curl snippets) that utilizes the Tririga Rest Administration API, as specified here: API documentation - IBM Documentation.
- How is a client to the admin API authenticated?
- How is authentication/authorization passed to API calls
------------------------------
James Combs
------------------------------
#TRIRIGA
#AssetandFacilitiesManagement