Get users, up to 50 per page. This example returns users created within a date range. (To get all users, simply remove all query params.)
curl 'https://api.us.onelogin.com/api/1/users?since=2018-04-01T19:44:55.681Z&until=2018-04-16T19:44:55.681Z' \
-H "Authorization: bearer:onelogin_access_token" \
-H "Accept: application/json"
[Reflection.Assembly]::LoadFile("C:\myAssemblies\ChilkatDotNet2.dll")
$rest = New-Object Chilkat.Rest
# URL: https://api.us.onelogin.com/api/1/users?since=2018-04-01T19:44:55.681Z&until=2018-04-16T19:44:55.681Z
$bTls = $true
$port = 443
$bAutoReconnect = $true
$success = $rest.Connect("api.us.onelogin.com",$port,$bTls,$bAutoReconnect)
if ($success -ne $true) {
$("ConnectFailReason: " + $rest.ConnectFailReason)
$($rest.LastErrorText)
exit
}
$rest.AddHeader("Authorization","bearer:onelogin_access_token")
$rest.AddHeader("Accept","application/json")
$sbResponseBody = New-Object Chilkat.StringBuilder
$success = $rest.FullRequestNoBodySb("GET","/api/1/users?since=2018-04-01T19:44:55.681Z&until=2018-04-16T19:44:55.681Z",$sbResponseBody)
if ($success -ne $true) {
$($rest.LastErrorText)
exit
}
$respStatusCode = $rest.ResponseStatusCode
if ($respStatusCode -ge 400) {
$("Response Status Code = " + $respStatusCode)
$("Response Header:")
$($rest.ResponseHeader)
$("Response Body:")
$($sbResponseBody.GetAsString())
exit
}
$jsonResponse = New-Object Chilkat.JsonObject
$jsonResponse.LoadSb($sbResponseBody)
$statusError = $jsonResponse.BoolOf("status.error")
$statusCode = $jsonResponse.IntOf("status.code")
$statusType = $jsonResponse.StringOf("status.type")
$statusMessage = $jsonResponse.StringOf("status.message")
$paginationBefore_cursor = $jsonResponse.StringOf("pagination.before_cursor")
$paginationAfter_cursor = $jsonResponse.StringOf("pagination.after_cursor")
$paginationPrevious_link = $jsonResponse.StringOf("pagination.previous_link")
$paginationNext_link = $jsonResponse.StringOf("pagination.next_link")
$i = 0
$count_i = $jsonResponse.SizeOfArray("data")
while ($i -lt $count_i) {
$jsonResponse.I = $i
$activated_at = $jsonResponse.StringOf("data[i].activated_at")
$created_at = $jsonResponse.StringOf("data[i].created_at")
$email = $jsonResponse.StringOf("data[i].email")
$username = $jsonResponse.StringOf("data[i].username")
$firstname = $jsonResponse.StringOf("data[i].firstname")
$group_id = $jsonResponse.StringOf("data[i].group_id")
$id = $jsonResponse.IntOf("data[i].id")
$invalid_login_attempts = $jsonResponse.StringOf("data[i].invalid_login_attempts")
$invitation_sent_at = $jsonResponse.StringOf("data[i].invitation_sent_at")
$last_login = $jsonResponse.StringOf("data[i].last_login")
$lastname = $jsonResponse.StringOf("data[i].lastname")
$locked_until = $jsonResponse.StringOf("data[i].locked_until")
$comment = $jsonResponse.StringOf("data[i].comment")
$openid_name = $jsonResponse.StringOf("data[i].openid_name")
$locale_code = $jsonResponse.StringOf("data[i].locale_code")
$password_changed_at = $jsonResponse.StringOf("data[i].password_changed_at")
$phone = $jsonResponse.StringOf("data[i].phone")
$status = $jsonResponse.IntOf("data[i].status")
$updated_at = $jsonResponse.StringOf("data[i].updated_at")
$distinguished_name = $jsonResponse.StringOf("data[i].distinguished_name")
$external_id = $jsonResponse.StringOf("data[i].external_id")
$directory_id = $jsonResponse.StringOf("data[i].directory_id")
$member_of = $jsonResponse.StringOf("data[i].member_of")
$samaccountname = $jsonResponse.StringOf("data[i].samaccountname")
$userprincipalname = $jsonResponse.StringOf("data[i].userprincipalname")
$manager_ad_id = $jsonResponse.StringOf("data[i].manager_ad_id")
$company = $jsonResponse.StringOf("data[i].company")
$department = $jsonResponse.StringOf("data[i].department")
$title = $jsonResponse.StringOf("data[i].title")
$state = $jsonResponse.IntOf("data[i].state")
$trusted_idp_id = $jsonResponse.StringOf("data[i].trusted_idp_id")
$role_id = $jsonResponse.StringOf("data[i].role_id")
$j = 0
$count_j = $jsonResponse.SizeOfArray("data[i].role_id")
while ($j -lt $count_j) {
$jsonResponse.J = $j
$intVal = $jsonResponse.IntOf("data[i].role_id[j]")
$j = $j + 1
}
$i = $i + 1
}
{
"status": {
"error": false,
"code": 200,
"type": "success",
"message": "Success"
},
"pagination": {
"before_cursor": null,
"after_cursor": null,
"previous_link": null,
"next_link": null
},
"data": [
{
"activated_at": null,
"created_at": "2018-04-16T00:56:54.632Z",
"email": "admin@chilkatsoft.com",
"username": null,
"firstname": "Matt",
"group_id": null,
"id": 38979073,
"invalid_login_attempts": null,
"invitation_sent_at": "2018-04-16T00:56:54.610Z",
"last_login": "2018-04-16T21:03:54.168Z",
"lastname": "Fausey",
"locked_until": null,
"comment": null,
"openid_name": "admin",
"locale_code": null,
"password_changed_at": "2018-04-16T00:57:44.965Z",
"phone": null,
"status": 1,
"updated_at": "2018-04-16T21:03:54.253Z",
"distinguished_name": null,
"external_id": null,
"directory_id": null,
"member_of": null,
"samaccountname": null,
"userprincipalname": null,
"manager_ad_id": null,
"role_id": [
214639
],
"company": null,
"department": null,
"title": null,
"state": 1,
"trusted_idp_id": null
},
{
"activated_at": null,
"created_at": "2018-04-16T01:00:33.687Z",
"email": "matt@chilkat.io",
"username": "matt",
"firstname": "Matt",
"group_id": null,
"id": 38979078,
"invalid_login_attempts": null,
"invitation_sent_at": null,
"last_login": null,
"lastname": "Chilkat",
"locked_until": null,
"comment": "",
"openid_name": "matt",
"locale_code": null,
"password_changed_at": null,
"phone": "6302581871",
"status": 1,
"updated_at": "2018-04-16T01:00:33.791Z",
"distinguished_name": null,
"external_id": null,
"directory_id": null,
"member_of": null,
"samaccountname": null,
"userprincipalname": null,
"manager_ad_id": null,
"role_id": null,
"company": "Chilkat Software, Inc.",
"department": "Development",
"title": "Programmer",
"state": 1,
"trusted_idp_id": null
}
]
}