Profile picture for user m3b

Here is  a working code snippet showing how to use Aris (Enterprise Version 10SR19 )  Rest API. 

I had to perform numerous searchs to make it work, I guess this may be useful to others.

Note 

  •  the user runnnig the script must have Aris Api license rigths
  •  the script is written in Microsoft Powershell V5 . Invoke-RestMethod is similar to curl + Json handling

 

$serverUrl="https://arisserver/"
$tokenURL = $serverUrl + "umc/api/v2/tokens"
# ----------------------------
# Get authentication token
# ----------------------------
$body = @{"tenant"="default"; "name"= "username";"password"="userpassword";}
$response = Invoke-RestMethod -Body $Body -Method Post  $tokenURL
$token =  $response.token
# ----------------------------
# Create a session to store the authentication token into a cookie 
# The cookie will be passed along in the below API calls . 
# ----------------------------
# The coookie name must be "accesstoken"
# this is not documented in Aris document ARIS REPOSITORY API TECHNICAL INTRODUCTION" , august 2022
# ----------------------------
$session = [Microsoft.PowerShell.Commands.WebRequestSession]::new()
$cookie = [System.Net.Cookie]::new('accesstoken', $response.token)
$session.Cookies.Add($serverUrl, $cookie)
# ----------------------------
# Now let's make some API Calls
# ----------------------------
# Get list of databases
$arisAPI = "abs/api/"
$getDatabaseURL = $serverUrl + $arisAPI +"databases" 
$response2 = Invoke-RestMethod  -Method Get -WebSession $session $getDatabaseURL
# Use results, for example : $response2.item_count is the number of databases
# Get list of users
$getUsersURL = $serverUrl + "/umc/api/users" 
# pass on parameters
$body = @{"offset"=0; "limit"= 5}
$response3 = Invoke-RestMethod  -Body $body -Method Get -WebSession $session $getUsersURL
# download a document file from Aris data storage (ADS) and save it to PC's desktop
$docId = "xxx-xxxx-xxx-x" #get the id from the doc properties in ADS
$docURL = $serverUrl+"documents/api/documents/"+$docId+"/content"
$localFile="C:\Users\xxxx\Desktop\testADS.xlsx"
$response4 = Invoke-RestMethod  -Method Get -WebSession $session -Outfile $localFile $docURL 
# ----------------------------
# logout , revoke the authentication token
# ----------------------------
$logoutURL = $serverUrl + "umc/api/tokens/"+$token
$response5 = Invoke-RestMethod  -Method Delete -WebSession $session $logoutURL

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock