Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


The Admin API provides interfaces for user management.

Authentification

In order to call the Admin APIs such a client must be registrated in the primedocs.config, for this see primedocs config.

After registration, an AccessToken can be requested from the IdS.

This PowerShell example shows the AccessToken’s request:

# Configuration
$datasourceId = "b78c3707-d7c7-4fc7-b97f-87d70f63c1ac"
$tokenUrl = "https://customerserver.local/ids/connect/token"
$clientID = "CustomApiClient"
$clientSecret = "CustomClient_Secret_123"
$scope = "pd_AdminWebApi"

$tokenRequestHeaders = @{
    "Content-Type" = "application/x-www-form-urlencoded"
}

$tokenRequestBody = @{
    client_id     = $clientID
    client_secret = $clientSecret
    grant_type    = "client_credentials"
    scope         = $scope
}

# Request the access token

try {
    $tokenResponse = Invoke-RestMethod -Uri $tokenUrl -Method POST -Headers $tokenRequestHeaders -Body $tokenRequestBody
}
catch {
    Write-Error "Error making the request: $_"
    exit 1;
}

if (-not $tokenResponse.access_token) {
    Write-Error "Failed to obtain an access token!"
    exit 1
}

# Access token information
Write-Host "Access Token: $($tokenResponse.access_token)"
$accessToken = $tokenResponse.access_token

Examples

This AccessToken must be included in the Authorization header for all calls. The API currently allows users to be listed, created and edited. Examples can be found below

List users

This lists existing users:

# Prepare headers for request
$apiRequestHeaders = @{
    "Authorization" = "Bearer $accessToken"
}

Write-Host "Getting users..."
$pageSize = Read-Host "Enter pagesize"
$page = Read-Host "Enter page"

try {
    $apiUrl = "https://customerserver.local/webapi/api/v3/$($datasourceId)/Admin/Users?pageSize=$($pageSize)&page=$($page)"
    $response = Invoke-RestMethod -Uri $apiUrl -Method GET -Headers $apiRequestHeaders     

    foreach ($user in $response.data) {
          Write-Output "$($user.id): '$($user.title)'"
    }
    Write-Output "Page: $($response.pagingDetails.page) / $($response.pagingDetails.totalPages)"
}
catch {
    Write-Error "Error making the request: $_"
    exit 1;
}

User onboarding

This call can be used to add a new user using the SID. The User Onboarding process is then run automatically.

# Prepare headers for request
$apiRequestHeaders = @{
    "Authorization" = "Bearer $accessToken"
}

$sid = Read-Host "Enter SID"
Write-Host "Creating and onboarding user with SID: $sid" 

try {
  $apiUrl = "https://customerserver.local/webapi/api/v3/$($datasourceId)/Admin/Users?sid=" + $sid;
  $user = Invoke-RestMethod -Uri $apiUrl -Method POST -Headers $apiRequestHeaders
  Write-Output "Onboarded '$($user.title)' with id '$($user.id)'";
}
catch {
  Write-Error "Error making the request: $_"
  exit 1;
}

Swagger / Open API

The current Admin API Open API looks like the following in the version 4.0.20122.

You can visualize this description for example via the Swagger Editor.

{
    "openapi": "3.0.1",
    "info": {
        "title": "primedocs WebApi (Admin Only)",
        "version": "v3"
    },
    "servers": [
        {
            "url": "/webapi"
        }
    ],
    "paths": {
        "/api/v3/{datasourceId}/Admin/OrganizationUnits": {
            "get": {
                "tags": [
                    "AdminOrganizationUnit"
                ],
                "parameters": [
                    {
                        "name": "PageSize",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    },
                    {
                        "name": "Page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    },
                    {
                        "name": "datasourceId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PagedResponse`1<AdminOrganizationUnitInfo[]v3>"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v3/{datasourceId}/Admin/Users": {
            "get": {
                "tags": [
                    "AdminUser"
                ],
                "parameters": [
                    {
                        "name": "PageSize",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    },
                    {
                        "name": "Page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    },
                    {
                        "name": "datasourceId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PagedResponse`1<AdminUserInfo[]v3>"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "AdminUser"
                ],
                "parameters": [
                    {
                        "name": "sid",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "datasourceId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AdminUserDetailInfoV3"
                                }
                            }
                        }
                    }
                }
            }
        },
        
        "/api/v3/{datasourceId}/Admin/Users/{userId}": {
            "get": {
                "tags": [
                    "AdminUser"
                ],
                "parameters": [
                    {
                        "name": "userId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "datasourceId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AdminUserDetailInfoV3"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v3/{datasourceId}/Admin/Users/{userId}/Profiles/{profileId}": {
            "put": {
                "tags": [
                    "AdminUser"
                ],
                "parameters": [
                    {
                        "name": "userId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "profileId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "datasourceId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AdminProfileUpdateEditV3"
                            }
                        },
                        "text/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AdminProfileUpdateEditV3"
                            }
                        },
                        "application/*+json": {
                            "schema": {
                                "$ref": "#/components/schemas/AdminProfileUpdateEditV3"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success"
                    }
                }
            },
            "get": {
                "tags": [
                    "AdminUser"
                ],
                "parameters": [
                    {
                        "name": "userId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "profileId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "datasourceId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AdminProfileDetailInfoV3"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v3/{datasourceId}/Admin/Users/{userId}/Profile/{profileId}/ProfileShares": {
            "put": {
                "tags": [
                    "AdminUser"
                ],
                "parameters": [
                    {
                        "name": "userId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "profileId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "datasourceId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AdminProfileShareEditV3"
                            }
                        },
                        "text/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AdminProfileShareEditV3"
                            }
                        },
                        "application/*+json": {
                            "schema": {
                                "$ref": "#/components/schemas/AdminProfileShareEditV3"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "AdditionalProfileInfoV3": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "index": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "userTitle": {
                        "type": "string",
                        "nullable": true
                    },
                    "organizationUnitTitle": {
                        "type": "string",
                        "nullable": true
                    },
                    "organizationUnitPath": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "AdminOrganizationUnitInfoV3": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "AdminProfileDetailInfoV3": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "organizationUnitId": {
                        "type": "string",
                        "format": "uuid",
                        "nullable": true
                    },
                    "organizationUnitTitle": {
                        "type": "string",
                        "nullable": true
                    },
                    "profileShares": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/AdminProfileShareV3"
                        },
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "AdminProfileInfoV3": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "organizationUnitId": {
                        "type": "string",
                        "format": "uuid",
                        "nullable": true
                    },
                    "organizationUnitTitle": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "AdminProfileShareEditV3": {
                "type": "object",
                "properties": {
                    "accountId": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "profilePermissionLevel": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "signaturePermissionLevel": {
                        "type": "integer",
                        "format": "int32"
                    }
                },
                "additionalProperties": false
            },
            "AdminProfileShareV3": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "accountId": {
                        "type": "string",
                        "format": "uuid"
                    }
                },
                "additionalProperties": false
            },
            "AdminProfileUpdateEditV3": {
                "type": "object",
                "properties": {
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "organizationUnitId": {
                        "type": "string",
                        "format": "uuid"
                    }
                },
                "additionalProperties": false
            },
            "AdminUserDetailInfoV3": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "primarySid": {
                        "type": "string",
                        "nullable": true
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "profiles": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/AdminProfileInfoV3"
                        },
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "AdminUserInfoV3": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "primarySID": {
                        "type": "string",
                        "nullable": true
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "FlatFieldInfoV3": {
                "type": "object",
                "properties": {
                    "field": {
                        "type": "string",
                        "nullable": true
                    },
                    "text": {
                        "type": "string",
                        "nullable": true
                    },
                    "inheritance": {
                        "type": "string",
                        "nullable": true
                    },
                    "isImage": {
                        "type": "boolean"
                    },
                    "lcid": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "profileId": {
                        "type": "string",
                        "format": "uuid",
                        "nullable": true
                    },
                    "_links": {
                        "type": "object",
                        "additionalProperties": {
                            "$ref": "#/components/schemas/LinkV3"
                        },
                        "nullable": true,
                        "readOnly": true
                    }
                },
                "additionalProperties": false
            },
            "LinkV3": {
                "type": "object",
                "properties": {
                    "href": {
                        "type": "string",
                        "nullable": true
                    },
                    "type": {
                        "type": "string",
                        "nullable": true
                    },
                    "id": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "PagedResponse`1<AdminOrganizationUnitInfo[]v3>": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/AdminOrganizationUnitInfoV3"
                        },
                        "nullable": true
                    },
                    "pagingDetails": {
                        "$ref": "#/components/schemas/PagingDetails"
                    }
                },
                "additionalProperties": false
            },
            "PagedResponse`1<AdminUserInfo[]v3>": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/AdminUserInfoV3"
                        },
                        "nullable": true
                    },
                    "pagingDetails": {
                        "$ref": "#/components/schemas/PagingDetails"
                    }
                },
                "additionalProperties": false
            },
            "PagedResponse`1<SharedProfileInfo[]v3>": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/SharedProfileInfoV3"
                        },
                        "nullable": true
                    },
                    "pagingDetails": {
                        "$ref": "#/components/schemas/PagingDetails"
                    }
                },
                "additionalProperties": false
            },
            "PagingDetails": {
                "type": "object",
                "properties": {
                    "pageSize": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "page": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "totalPages": {
                        "type": "integer",
                        "format": "int32"
                    }
                },
                "additionalProperties": false
            },
            "ProfileInfoV3": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "hasProfileImage": {
                        "type": "boolean"
                    },
                    "_links": {
                        "type": "object",
                        "additionalProperties": {
                            "$ref": "#/components/schemas/LinkV3"
                        },
                        "nullable": true,
                        "readOnly": true
                    },
                    "organizationUnitId": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "isDefault": {
                        "type": "boolean"
                    }
                },
                "additionalProperties": false
            },
            "SearchInputFieldsResponseModel": {
                "type": "object",
                "properties": {
                    "dataProviderDisplayName": {
                        "type": "string",
                        "nullable": true
                    },
                    "searchParametersConfigurationXmlSerialized": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "SharedProfileInfoV3": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "hasProfileImage": {
                        "type": "boolean"
                    },
                    "_links": {
                        "type": "object",
                        "additionalProperties": {
                            "$ref": "#/components/schemas/LinkV3"
                        },
                        "nullable": true,
                        "readOnly": true
                    },
                    "organizationUnitId": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "isDefault": {
                        "type": "boolean"
                    },
                    "isForeignProfile": {
                        "type": "boolean"
                    },
                    "isPinned": {
                        "type": "boolean"
                    },
                    "organizationUnitThemes": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "UserInfoV3": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "profiles": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ProfileInfoV3"
                        },
                        "nullable": true
                    },
                    "primarySID": {
                        "type": "string",
                        "nullable": true
                    },
                    "SIDs": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "nullable": true
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "hasUserImage": {
                        "type": "boolean"
                    },
                    "localizedFlatFields": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "$ref": "#/components/schemas/FlatFieldInfoV3"
                            }
                        },
                        "nullable": true
                    },
                    "_links": {
                        "type": "object",
                        "additionalProperties": {
                            "$ref": "#/components/schemas/LinkV3"
                        },
                        "nullable": true,
                        "readOnly": true
                    }
                },
                "additionalProperties": false
            }
        },
        "securitySchemes": {
            "oauth2": {
                "type": "oauth2",
                "flows": {
                    "implicit": {
                        "authorizationUrl": "https://{tenanturl}/ids/connect/authorize",
                        "scopes": {
                            "oo_WebApi": "Web API"
                        }
                    }
                }
            }
        }
    },
    "security": [
        {
            "oauth2": [
                "oo_WebApi"
            ]
        }
    ]
}
  • No labels