User management (REST API)
You'll find here 2 samples of API calls and their use that you'll find in our API catalog
List or search Accounts
Create an Account
Paging and "hasMore" value
Some of the results of the API calls are paginated. To know when the results exceed the value of the "limit" defined in your REST request, you must check the value "hasMore" in the result .json.
If in the result .json the value "hasMore" returns "false" it means that there is no next page and it is not necessary to continue.
If in the result .json the value "hasMore" returns "true", this means that the result of this request continues on the next page, you will have to re-launch the same request but increasing the value "page" by 1.
Initial "page" value: 0
max "limit" value: 100
List or search Accounts
GET /auth/v1/customer/services/accounts |
---|
Use GET requests to retrieve the list of user Accounts or *requested accounts of a TrustBuilder Service.
Parameters | Parameter Type | Data Type | Required ? | description |
---|---|---|---|---|
page | query | int | Optional | The requested page. Zero based. Default is 0. |
limit | query | int | Optional | The number of maximum results. Default is 50. |
Method
Request | Employed method |
---|---|
API Endpoint | https://kiwi.myinwebo.com/auth/v1/customer/services/accounts |
Verb | GET |
Content-Type: | */* |
Header | Accept: application/json |
Authentication | Authorization: Bearer xxxxxxyyyyyyzzzzzz |
CURL command to retrieve the list of accounts
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer xxxxxxyyyyyyzzzzzz' 'https://kiwi.myinwebo.com/auth/v1/customer/services/accounts?page=0&limit=50'
Invoke-RestMethod command to retrieve the list of accounts in PowerShell
$Url = "https://kiwi.myinwebo.com/auth/v1/customer/services/accounts?page=0&limit=50"
$token = "xxxxxxyyyyyyzzzzzz"
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer $token")
$ResultURL = Invoke-RestMethod -Method 'Get' -Uri $Url -Headers $headers
HTTP (JSON) Response - 200 OK
HTTP/1.1 200 OK
Content-Type: application/json
{
"page" : 0,
"size" : 1,
"limit" : 50,
"hasMore" : false,
"content" : [ {
"login" : "TrustBuilderLogin",
"email" : "email@example.com",
"language" : "fr",
"active" : true,
"role" : {
"id" : "0",
"name" : "User"
},
"createdDate" : "2019-03-30T10:48:32.936Z",
"modifiedDate" : "2019-03-30T10:48:32.936Z",
"lastAuthenticatedDate" : "2019-03-30T10:48:32.936Z"
} ]
}
Create an Account
POST /auth/v1/customer/services/accounts |
---|
Post a JSON/Data to the API endpoint to create an Account
Method
Request | Employed method |
---|---|
API Endpoint | https://kiwi.myinwebo.com/auth/v1/customer/services/accounts |
Verb | POST |
Content-Type: |
|
Header | Accept: application/json |
Authentication | Authorization: Bearer xxx.yyy.zzz |
CURL command to POST JSON data
curl -X POST --header 'Accept: application/json' --header 'Authorization: Bearer xxxxxxyyyyyyzzzzzz' 'https://kiwi.myinwebo.com/auth/v1/customer/services/accounts' -d {\"login... }
JSON data model to POST for Account creation
{
"login" : "TrustBuilderLogin",
"email" : "email@example.com",
"language" : "fr",
"active" : true,
"role" : {
"id" : "0"
},
"memberships" : [ {
"group" : {
"id" : "1"
},
"role" : {
"id" : "0"
}
} ]
}
HTTP(JSON) Response - 201 Created
HTTP/1.1 201 Created
Content-Type: application/json
{
"login" : "TrustBuilderLogin",
"email" : "email@example.com",
"language" : "fr",
"active" : true,
"role" : {
"id" : "0",
"name" : "User"
},
"memberships" : [ {
"group" : {
"id" : "1",
"name" : "group1"
},
"role" : {
"id" : "0",
"name" : "User"
}
} ],
"createdDate" : "2021-12-17T10:48:32.936Z"
"provisioningId" : 0
}
The "provisioningId"
value is the user creation source. Possible values:
0: created by the administration console
1: created by IWDS (default value)
>1: other provisioning source