Leverage the REST API in Dundas BI for External Administration

In this video, we explore how you can identify and use a REST API inside Dundas BI to perform application functions without stepping foot in the application

NOTE:

Things have changed a little bit since this was posted and the script will require a slight modification. Specifically, it is now required to properly set the content type to application/json. Here is a full modified script.

$body = @{
"accountName"="YOURACCOUNT"
"password"="YOURPASSWORD"
"cultureName"="en-us"
"deleteOtherSessions"="false"
"isWindowsLogOn"="false"
} | ConvertTo-Json

#view​ body (for testing)
$body

$response = Invoke-WebRequest -UseBasicParsing -Uri 'https://YOURSERVERADDRESS/Api/LogOn'​ -ContentType application/json -Method 'POST' -Body $body

#check​ response
$response
#
#StatusCode​ : 200
#StatusDescription​ : OK
#Content​ : {"sessionId":"80247c55-4268-4366-ab70-#19abcdc1153a​","logOnFailureReason":"None","message":"Successful"}
#RawContent​ : HTTP/1.1 200 OK
# Pragma: no-cache
# Content-Length: 103
# Cache-Control: no-cache
# Content-Type: application/json; charset=utf-8
# Date: Fri, 26 Mar 2021 17:39:10 GMT
# Expires: -1
# # {"sessionId":"80247c...
#Forms​ :
#Headers​ : {[Pragma, no-cache], [Content-Length, 103], [Cache-Control, no-cache],
[Content-#Type​, application/json; charset=utf-8]...}
#Images​ : {}
#InputFields​ : {}
#Links​ : {}
#ParsedHtml​ :
#RawContentLength​ : 103
#

$sessionId = $response |ConvertFrom-Json | Select sessionId
$sesh = $sessionId.sessionId

$uri = 'https://YOURSERVERADDRESS/API/DataCub...​ + $sesh
$body = @{a='a'} | ConvertTo-Json
$response2 = Invoke-WebRequest -UseBasicParsing -Uri $uri -ContentType application/json -Method Post -Body $body

#check​ response2, it should be something like this if I worked.
#StatusCode​ : 200
#StatusDescription​ : OK
#Content​ : {}
#RawContent​ : HTTP/1.1 200 OK
# Pragma: no-cache
# Content-Length: 0
# Cache-Control: no-cache
# Date: Fri, 26 Mar 2021 17:49:22 GMT
# Expires: -1
#
#
#Headers​ : {[Pragma, no-cache], [Content-Length, 0], [Cache-Control, no-cache],
[Date, Fri, 26 #Mar​ 2021 17:49:22 GMT]...}
#RawContentLength​ : 0
#

 

About the Author

Jeff Hainsworth

Jeff Hainsworth is a Senior Solutions Architect at Dundas Data Visualization with over a decade and a half of experience in Business Intelligence. He has a passion for building, coding and everything visual – you know, shiny things! Check out "Off the Charts... with Jeff", his platform for great content on all things analytics, data visualizations, dashboards, and business intelligence. There’s something for everyone!

Print