...
...
Table of Contents |
---|
WIP REST API
...
Inside QlikView or Qlik Sense you can use the the Qlik Rest connector to query the WIP data model and make quite all reporting you can imagine
All tasks you can do using the WIP Web Interface you can do it using the API
As such an integration can be quite technical, you can ask us for a professional consulting offer to help you implement your project.
...
In the Body (x-www-form-urlencoded ) put the following parameters: for a login with VMMANAGER
Code Block | ||
---|---|---|
| ||
environment=223&:0 grant_type=:password& login_method=:0&password=XXXXX&username=W8-JP-VS15%5Cebidev password:EBIEXPERTS username:VMMANAGER plugin_type:-1 |
Get Login environment id
In Qlik Sense, QlikView, SAP, you will need to login using a certain environment. To find the environment
Id “environment id” open the server and environment then id enviId is in the URL
...
https://wipws:59272/wip/#!/home/serverEdit/<serverId>/qs/enviEdit/<enviId>/enviForm
Postman
Get token using Postman
Sample : get authentication token using REST Using Postman
Postman Export Sampleshared link sample: a Postman sample export that you can import to your Postman app
View file | ||
---|---|---|
|
Here is an example on how to get a WIP token using Postman, but it would be the same process to implement in your program.
...
environment: not mandatory for “user portal” and “admin users” but it is for “developer users”. It must contain the environment ID
grant_type: should be “password”
username: WIP username in the form “DOMAIN\USER” (you can also use “VMMANAGER”)
password: WIP Password for “password” authentication, AD for AD Authentication
login_method0method: 0for using password and 1 to use AD (Active Directory) to authenticate
...
plugin_type: -1 for not defined (VMMANAGER), 0 for QlikView [default for password] 1 for Qlik Sense , 2 for SAP, 3 for NPrinting
Example for a Qlik Sense Login using AD
Code Block |
---|
environment=223 |
...
grant_type=password |
...
login_method= |
...
1 password= |
...
******
username=WIP\User123
plugin_type=2 |
If the request succeeded that the response should contain the access token in a JSON text like this
Code Block | ||
---|---|---|
| ||
{ "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiMiIsInVuaXF1ZV9uYW1lIjoiVzgtSlAtVlMxNVxcZWJpZGV2IiwiYWN0b3JJZCI6IjIxNiIsImVudmlyb25tZW50SWQiOiIyMjMiLCJsb2dpbk1ldGhvZCI6IjAiLCJlbnZpcm9ubWVudFJlcG9zVHlwZSI6InFzIiwiZW52aXJvbm1lbnROYW1lIjoiMDAgUVNlbnNlIERFViIsImF2YXRhclVybCI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTkyNzIvZG93bmxvYWQvdXNlckF2YXRhcnMvaW1nX1ZtQWN0b3ItMjE2LnBuZyIsInVzZXJOZXh0UGFnZSI6IjAiLCJpc0xpY2Vuc2VWYWxpZCI6IlRydWUiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjU5MjcyLyIsImF1ZCI6ImFsbCIsImV4cCI6MTUxMTkyMzcwOSwibmJmIjoxNTExODgwNTA5fQ.NM1eKf1EyY_u7-Sw2qs6NwXSTXziFKowtQVXp2DXpPE", "token_type": "bearer", "expires_in": 43199 } |
Get token Using WIP browser
Login WIP using VMMANAGER / EBIEXPERTS (or your password)
...
Code Block |
---|
http:// <WIPSERVER>:59272/wip/#!/home/actors |
Click on GetAllActors should display
...
Copy the Authorization “Bearer XXXX” then you can paste it in Qlik Sense Requests like below will use same context as your WIP Session
Use the token for subsequent requests
...
You need to put the token in the header adding a new “Authorization” key and “bearer <token>” value
Authorization bearer <token>
Postman
...
You are not Type : Bearer Token
Query Postman
Put the Authorization in the collection Authorization
...
Create a variable to keep the WIP url
...
You are now connected to WIP rest API
Get pending publications :
Send a GET request to the url {{wipsurl}}/api/WipApi/GetPendingTips?businessUnitId=0
Set the authorization type to inherit from parent and press “Send”
...
Connect WIP API In Qlik Sense
...
After we can use these 2 connections for all requests.
Authentication
Method 1: Create a new POST Rest Connection
Create a new “WIPApiToken” connection using Qlik REST Connector
In the Body put the parameters separated by “&” and urlencode them if nescessary
...
URL: http(s)://<wip web server url>:59272/token
...
Don’t forget to rename the connection to “WIPApiToken” in the QMC
Method 2: Edit an Empty Rest connection in QMC
You can also create an empty rest connection and go to QMC and overwrite the connection string to
...
Set this script in 1st tab to get a valid WIP token and store it in a variable
Code Block | ||
---|---|---|
| ||
LET vWIPenvironmentID = 0; LET vWIPlogin_method = 0; // 0:Password, 1: Active Directory LET vWIPplugintype = 0; LET vWIPusername ='VMMANAGER'; LET vWIPpassword ='EBIEXPERTS'; LET vApi = '50.83.60.96:59272'; // Create the header LET vRequestBody =''; LET vRequestBody = vRequestBody & 'environment='& '$(vWIPenvironmentID)'; LET vRequestBody = vRequestBody & '&grant_type=password'; LET vRequestBody = vRequestBody & '&login_method='& '$(vWIPlogin_method)'; LET vRequestBody = vRequestBody & '&plugin_type='& '$(vWIPplugintype)'; LET vRequestBody = vRequestBody & '&password='& '$(vWIPpassword)'; LET vRequestBody = vRequestBody & '&username='& '$(vWIPusername)'; plugin_type=-1 LET vRequestBody = replace(vRequestBody,'"', chr(34)&chr(34)); // Get the WIP Token LIB CONNECT TO [WIPApiToken]; [token]: SQL SELECT "access_token" FROM JSON (wrap on) "root" WITH CONNECTION ( URL "http://$(vApi)/token", HTTPHEADER "Content-Type" "application/x-www-form-urlencoded", BODY "$(vRequestBody)" ); // Store the WIP Token into a variable LET vWIP_token = PEEK('access_token',-1,'token'); |
...
Get a token from the point Authentication
Add the token
The token should look like:
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiMiIsInVuaXF1ZV9uYW1lIjoiRUJJV0lOMjAxNlxcZWJpZGV2IiwiYWN0b3JJZCI6IjE5NyIsImVudmlyb25tZW50SWQiOiIyMDYiLCJsb2dpbk1ldGhvZCI6IjAiLCJlbnZpcm9ubWVudFJlcG9zVHlwZSI6InFzIiwiZW52aXJvbm1lbnROYW1lIjoiMDAgUVNFTlNFLURFViIsImF2YXRhclVybCI6Imh0dHA6Ly81NC4zNi4xNDcuMjIwOjU5MjcyL2Rvd25sb2FkL2RlZmF1bHRBdmF0YXJzL2RlZmF1bHQucG5nIiwidXNlck5leHRQYWdlIjoiMCIsImlzTGljZW5zZVZhbGlkIjoiVHJ1ZSIsImlzcyI6Imh0dHA6Ly81NC4zNi4xNDcuMjIwOjU5MjcyLyIsImF1ZCI6ImFsbCIsImV4cCI6MTUxMjc3MjMxMSwibmJmIjoxNTEyNzI5MTExfQ.EpVOdd2Z63oB1uhdhu33P5h8d_1KT3ZH-MaUdmFi_e8
Create a Header name “Authorization” and paste the token in Value like below. Then test connection
...
Sample POST Query Get Users
//-----------------------------------------------------
...
//-----------------------------------------------------
LIB CONNECT TO 'WIPApiPost';
RestConnectorMasterTable:
SQL SELECT
"id",
"name",
"avatarUrl",
"perVmQs",
"perVmFile",
"perVmEnvProps",
"perVmTip",
"perVmQv",
"perWipUp"
FROM JSON (wrap off) "data"
WITH CONNECTION (
URL "http://localhost:59272/api/Actors/GetAllActors",
HTTPHEADER "Authorization" "bearer $(vWIP_token)",
HTTPHEADER "Content-Type" "application/json; charset=utf-8",
BODY "{active: true,toValidate: false}"
);
[WIPActors]:
LOAD
[id] AS [actorId],
[name] AS [name],
[avatarUrl] AS [avatarUrl],
[perVmQs] AS [perVmQs],
[perVmFile] AS [perVmFile],
[perVmEnvProps] AS [perVmEnvProps],
[perVmTip] AS [perVmTip],
[perVmQv] AS [perVmQv],
[perWipUp] AS [perWipUp]
RESIDENT RestConnectorMasterTable;
DROP TABLE RestConnectorMasterTable;
Sample GET Query
You can use the Get Query we created before as we will override URL
There are 2 important things in the query:
URL "http://localhost:59272/api/businessUnit/GetAllBusinessUnits"
HTTPHEADER "Authorization" "bearer $(vWIP_token)"
Code Block |
---|
//----------------------------------------------------- |
...
// Get Business Units |
...
//----------------------------------------------------- |
...
LIB CONNECT TO 'WIPApiGet'; |
...
RestConnectorMasterTable: |
...
SQL |
...
SELECT "id", |
...
"name" |
...
FROM JSON (wrap off) "data" |
...
WITH CONNECTION |
...
( URL "http://localhost:59272/api/businessUnit/GetAllBusinessUnits", |
...
HTTPHEADER "Authorization" "bearer $(vWIP_token)" |
...
); |
...
[WIPBusinessUnits]: |
...
LOAD |
...
[id] AS [businessUnitId], |
...
[name] AS [businessUnitName] |
...
RESIDENT RestConnectorMasterTable; |
...
DROP TABLE RestConnectorMasterTable; |
How to get WIP Rest API urls (endpoints)
...
Open chrome on WIP
Press Ctrl-Shift-I
...
Using WIP Rest API Swagger Dictionary
WIP Rest API endpoints
You can get a full description of all rest api endpoints using this url
...
For the moment api wthat requires authentication will return an error: "message": "Authorization has been denied for this request."
Useful API Calls
Publish a pending publication (tip)
Code Block |
---|
{{wipsurl}}/api/WipApi/PublishTip?tipId=2463889&reload=true |
...
Get the list of pending publications for a business unit
Note |
---|
New in WIP October 2022 |
Code Block |
---|
{{wipsurl}}/api/WipApi/GetPendingTips?businessUnitId=0 |
...