WIP REST API
WIP Rest API will allow you to command WIP WebServer for automation. You can use it for example to trigger a publication, create users, assign licenses, import files, checkout / in and publish files towars your enterprise servers.
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.
WIP REST API Infrastructure
Authentication
Before you can use the WIP API you have to authenticate. Once authenticated you will receive a token from the API that you need to send to the header of each subsequent request
Request for a token
You need to make a POST request using /“<wipurl>:<wipport>/token” url
Sample: http://localhost:59272/token
In the Body (x-www-form-urlencoded ) put the following parameters:
environment:0 grant_type:password login_method:0 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” open the server and environment then enviId is in the URL
https://wipws:59272/wip/#!/home/serverEdit/<serverId>/qs/enviEdit/<enviId>/enviForm
Get token using Postman
Sample : get authentication token using REST Using Postman
Postman shared link sample: a Postman sample that you can import to your Postman app
https://www.getpostman.com/collections/74aca3fa32e7884d28de
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_method: 0 for 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
The Body in plain text should be URL encoded like this for example for a QlikView login
environment=223 grant_type=password login_method=0 password=****** username=WIP\User123 plugin_type=0
If you don’t need special rights or for read only queries you can login using VMMANAGER password like this
environment:0 grant_type:password login_method:0 password:EBIEXPERTS username:VMMANAGER plugin_type:-1
If the request succeeded that the response should contain a JSON text like this
{ "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)
In Chrome activate inspect (SHIFT-CTRL-I)
then type this url or select Users tab Go to Network tab
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
Let’s try to get the usernames using this endpoint:
You need to put the token in the header adding a new “Authorization” Type : Bearer Token
Postman
Put the Authorization in the collection Authorization
Create a variable to keep the WIP url
You are not connected to WIP rest API
Connect WIP API In Qlik Sense
In order to connect Qlik Sense (same for QlikView) you need to create 2 connections, one for GET requests and one for POST requests as we can’t change the Method afterward
After we can use these 2 connections for all requests.
Authentication
Create a POST Rest Connection
Create a new “WIPApiToken” connection using Qlik REST Connector
URL: http(s)://<wip web server url>:59272/token
Method: POST
Request Body:
environment=258&grant_type=password&login_method=0&password=EBIEXPERTS&plugin_type=-1&username=VMMANAGER
Use VMMANAGER credentials
Don’t forget to rename the connection to “WIPApiToken” in the QMC
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
CUSTOM CONNECT TO "provider=QvRestConnector.exe;url=http://51.83.60.96:59272/token;timeout=30;method=POST;requestBody=environment%257&grant_type%2password&login_method%20&password%2EBIEXPERTS&plugin_type%2-1&username%2VMMANAGER;httpProtocol=1.1;isKeepAlive=true;bodyEncoding=UTF-8;sendExpect100Continue=true;autoDetectResponseType=true;checkResponseTypeOnTestConnection=true;keyGenerationStrategy=0;authSchema=anonymous;skipServerCertificateValidation=false;useCertificate=No;certificateStoreLocation=LocalMachine;certificateStoreName=My;addMissingQueryParametersToFinalRequest=false;PaginationType=None;allowResponseHeaders=false;allowHttpsOnly=false;useProxy=false;proxyBypassOnLocal=false;proxyUseDefaultCredentials=true;"
Get The WIP Token in a variable
Set this script in 1st tab to get a valid WIP token
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');
Query WIP Rest API
In order to query WIP api you need or a POST or GET connection
Create a GET Connection
Use the URL below as it doesn’t need authentication
http://localhost:59272/api/Common/StaticData
B) Update the connection in QMC
You can also create an empty REST connection and go to QMC and overwrite the connection string to
CUSTOM CONNECT TO "provider=QvRestConnector.exe;url=http://51.83.60.96:59272/api/Common/StaticData;timeout=30;method=GET;requestBody=environment%20&grant_type%2password&login_method%20&password%2EBIEXPERTS&username%2VMMANAGER;httpProtocol=1.1;isKeepAlive=true;bodyEncoding=UTF-8;sendExpect100Continue=true;autoDetectResponseType=true;checkResponseTypeOnTestConnection=false;keyGenerationStrategy=0;authSchema=anonymous;skipServerCertificateValidation=false;useCertificate=No;certificateStoreLocation=LocalMachine;certificateStoreName=My;addMissingQueryParametersToFinalRequest=false;PaginationType=None;allowResponseHeaders=false;allowHttpsOnly=false;useProxy=false;proxyBypassOnLocal=false;proxyUseDefaultCredentials=true;"
For Rest API endpoints that requires authentication you need to add the token to the GET connection
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
//-----------------------------------------------------
// Get Actors
//-----------------------------------------------------
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)"
//-----------------------------------------------------
// 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)
Using the Google Chrome Developer tools
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
http://<wip webserver url>:<wip server port>/swagger/ui/index#/
example: http://localhost:59272/swagger/ui/index#/
From there you can explore the API let’s try to open Actors / BusinessUnit
And press “Try it out” button. Note that will work only on endpoints that not requires authentication
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)
{{wipsurl}}/api/WipApi/PublishTip?tipId=2463889&reload=true
Get the list of pending publications for a business unit
New in WIP October 2022
{{wipsurl}}/api/WipApi/GetPendingTips?businessUnitId=0
Add Comment