Skip to main content

Managing Users

A project in Shield looks like

{
"users": [
{
"id": "598688c6-8c6d-487f-b324-ef3f4af120bb",
"name": "John Doe",
"slug": "",
"email": "john.doe@gotocompany.com",
"metadata": {
"role": "\"user-1\""
},
"createdAt": "2022-12-09T10:45:19.134019Z",
"updatedAt": "2022-12-09T10:45:19.134019Z"
}
]
}

One thing to note here is that Shield only allow to have metadata key from a specific set of keys. This constraint is only for users. We can add metadata key using this metadata key API

API Interface

Create users

$ curl --location --request POST 'http://localhost:8000/admin/v1beta1/users'
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--header 'X-Shield-Email: admin@gotocompany.com'
--data-raw '{
"name": "Jonny Doe",
"email": "jonny.doe@gotocompany.com",
"metadata": {
"role": "user-3"
}
}'

List users

curl --location --request GET 'http://localhost:8000/admin/v1beta1/users'
--header 'Accept: application/json'

Get Users

$ curl --location --request GET 'http://localhost:8000/admin/v1beta1/users/e9fba4af-ab23-4631-abba-597b1c8e6608'
--header 'Accept: application/json''

Update Projects

$ curl --location --request PUT 'http://localhost:8000/admin/v1beta1/users/e9fba4af-ab23-4631-abba-597b1c8e6608'
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--data-raw '{
"name": "Jonny Doe",
"email": "john.doe001@gotocompany.com",
"metadata": {
"role" : "user-3"
}
}'