Skip to main content

Admin API

Contact your PKWARE Professional Services representative if you did not receive these sample script files, or if you need assistance with using the PKWARE PK Protect Admin API. To access the full api documentation, enter the following as a URL in your browser. <insert SEM URL>/mds/api-docs/index.html





Using the Admin API

To begin using API calls within your application, you must first connect and establish a session. This will use your Admin API key that was issued when EnableAPI was selected for your SEM admin ID. The steps to establish this session are shown below using PowerShell.

CODE
$myPK ProtectHost = "pkware.PK Protect.com"
$myAdminAPItoken  = "DFRmZPCdGDqg3wgOcJ7FUA"
$ConnectURL       = "https://"+$mySmartcryptHost+"/mds/su/api/v1.0/Login"
$setToken = @{
           token = $myAdminAPItoken
       }
Write-Host " "
Write-Host "GETTING ADMIN API CONNECT TOKEN-$ConnectURL"
$RESP = Invoke-RestMethod -Uri $ConnectURL -Method Post -Body $setToken
Write-Host "Token=$RESP"


The value returned from this call will be the authorization string that must be included within the header of each subsequent call you make. The value returned will be similar to what appears below:

CODE
Token=eyJleHBpcmF0aW9uIjoiMjAxOS0xMi0wNVQxOTowODoyMloiLCJub25jZSI6Ikp4Q2hLc0pFR2hkX29tdVptM XZsRVcyTmghNXh3TURKd3ZRX1lSY0UhQlUiLCJzaWduYXR1cmUiOiIxNDk2NzpydDgzdjI0ZFRZRnRHL1dvVTdrRUw2 VmlOQkFjdER0bGJnS2V5ekhRN2FFPSIsInVzZXJJZCI6Nzd9




You can insert your authorization string into your request header as shown.

CODE
$setAuthToken = @{
Authorization = "MDS $RESP"
}



Make sure you include the string prefix “MDS “ in front of the value of your authorization string. You can then make calls using other Admin API functions. For example, the lines below will request all Communities.

CODE
$CommunityURL = "https://"+$mySmartcryptHost+"/mds/su/api/v1.0/Archive/Community" Write-Host "GETTING ALL COMMUNITIES " Invoke-RestMethod -Uri $CommunityURL -Method Get -Header $setAuthToken




Additional Samples Using the Admin API

Contact your PKWARE Professional Services representative if you did not receive these sample script files, or if you need assistance with using the PKWARE PK Protect Admin API. Most often, the best way for a developer to learn a new API is through working samples. PKWARE provides several sample scripts showing commonly used operations with Communities and Assignments. These samples include using methods to list (GET), create (POST), update (PUT) and delete (DELETE) both community and assignment records. These samples are currently only available for PowerShell. The samples that accompany this guide include these files:

assignments.ps1 – Examples using communities with assignments. Includes GET, POST, PUT, and DELETE operations.

community.ps1 - Examples using communities. Includes GET, POST, PUT, and DELETE operations. Before running these scripts, you will need to edit several variables that require values from your

PK Protect Enterprise Manager. Set the following using values from your SEM configuration:

CODE
$mySmartcryptHost = "SET THIS TO MATCH YOUR SEM"
$myAdminAPItoken = "SET THIS TO MATCH TOUR SEM"
$myUser1 = "user1@PK Protect.com"
$myUser2 = "user2@PK Protect.com"
$myUser3 = "user3@PK Protect.com"






JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.