User
Add a User
Endpoint
POST /passportsvc/api/v1/accounts
Parameters
Body
Pass a User class object. Please set the optional _tempPassword to true to consider _password as temporary and enforce the user to reset the password on their first login.
{
"_firstname": "john",
"_lastname": "doe",
"_email": "doe@company.com",
"_password": "Password@1",
"_tempPassword": true
}
Response
Codes
| Code | Description |
|---|---|
200 | Success |
Response data example
{
"_id": "ab50463c-074f-4bbb-905b-c1a7e1fbdfcf",
"_firstName": "john",
"_lastName": "doe",
"_email": "doe@company.com",
"_eusa": false,
"_privacy": false
}
Find all Users
Endpoint
GET /passportsvc/api/v1/users
Request
Body parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
query | String | Enter text to search fields such as the _firstName, _lastName or _email properties. The users are ordered by _firstName in the response. | Optional |
Body parameters examples
query=john- matches John Williams, john doe, Andrew John,john@company.comquery=and- matches andrew@company.com, Andy, Andom etc.
Response
{
"_offset": 0,
"_pageSize": 2,
"_total": 2,
"_list": [
{
"_id": "77cb6211-b9a2-4313-9aa7-4d15209203c7",
"_firstname": "john",
"_lastname": "doe",
"_eusa": false,
"_privacy": true,
"_disabled": false
},
{
"_id": "646467e6-53c1-4775-b4bf-6fc937e62935",
"_firstname": "James",
"_lastname": "Anderson",
"_eusa": false,
"_privacy": true,
"_disabled": false
}
]
}
Get Me
Gets the current user
Endpoint
GET /passportsvc/api/v1/users/me
Response data
{
"_id": "bb96242e-9977-4fb6-9bc2-7f56b11cdeda",
"_firstname": "John",
"_lastname": "d",
"_eusa": false,
"_privacy": false,
"_email": "john.d@mailinator.com",
"_disabled": false
}
Update User
Endpoint
PUT /passportsvc/api/v1/users/{id}
Request
Query parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
_id | String | The user's id | Optional |
Body parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
_firstname | String | Edit the user's first name. | Optional |
_lastname | String | Edit the user's last name. | Optional |
_disabled | Boolean | Enable or disable the user. | Optional |
Body parameter example
{
"_firstname" : "John",
"_lastname" : "d",
"_disabled": true
}
Response
Response data example
{
"_id": "bb96242e-9977-4fb6-9bc2-7f56b11cdeda",
"_firstname": "John",
"_lastname": "d",
"_eusa": false,
"_privacy": false,
"_email": "john.d@mailinator.com",
"_disabled": false
}
Enable/Disable User
Endpoint
PUT /passportsvc/api/v1/users/{id}/disabled
Request
Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
_id | String | The user's id | Optional |
Body
// disables the user
true
// enables the user
false
Response
{
"_id": "bb96242e-9977-4fb6-9bc2-7f56b11cdeda",
"_firstname": "John",
"_lastname": "d",
"_eusa": false,
"_privacy": false,
"_email": "john.d@mailinator.com",
"_disabled": false
}
Get User by Id
Endpoint
GET /passportsvc/api/v1/users/{id}
Request
Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
_id | String | The user's id | Optional |
Response
Response data example
{
"_id": "bb96242e-9977-4fb6-9bc2-7f56b11cdeda",
"_firstname": "John",
"_lastname": "d",
"_eusa": false,
"_privacy": false,
"_disabled": false
}