User creation
This document outlines the process for creating a user in OZmap. Follow the steps below to successfully create a user with the appropriate access and role.
Here are the steps to create an user:
Identify the projects: Determine which projects the user will have access to.
Identify the role: Determine the role that the user will be assigned.
Create the user: Create the user with access to the specified projects and assigned role.
Example
Identify the projects
To find the projects, make a request to the /projects
endpoint to list all available projects and obtain the IDs for the projects to which the user should have access.
curl --location -g --request \
GET 'https://sandbox.ozmap.com.br:9994/api/v2/projects \
--header 'authorization: AUTHORIZATION_TOKEN'
The expected return would be:
{
"total": 2,
"count": 2,
"rows": [
{
"lat": -27.576620124852862,
"lng": -48.52703645825386,
"name": "Example",
"drop": {
"defaults": {
"cableType": "5d83b2fcd846ae365237b3a1"
},
"maxSize": 200
},
"defaultPonPotency": 0,
"createdAt": "2019-10-10T14:28:09.746Z",
"updatedAt": "2023-05-02T17:48:40.482Z",
"parents": [],
"hasLogo": false,
"id": "5d9f3ff9200141000647f814"
...
},
{
"lat": -27.576761340469492,
"lng": -48.52672532200813,
"parents": [],
"name": "Example 2",
"hasLogo": false,
"drop": {
"maxSize": 200,
"defaults": {
"cableType": "5d83b2fcd846ae365237b3a1"
}
},
"defaultPonPotency": 0,
"createdAt": "2024-02-14T19:21:24.233Z",
"updatedAt": "2024-04-29T16:32:35.933Z",
"id": "65cd12b41030fa001426909e",
...
},
],
"start": 0,
"limit": 25
}
In this response, you can see two projects named "Example" and "Example 2." For this example, we will assign the user access only to the project named "Example," which has the ID 5d9f3ff9200141000647f814
.
Identify the role:
To find the available roles, make a request to the /roles
endpoint to list all roles and obtain the ID for the desired role.
curl --location -g --request \
GET 'https://sandbox.ozmap.com.br:9994/api/v2/roles \
--header 'authorization: AUTHORIZATION_TOKEN'
The expected return would be:
In this response, you can see the ID and name of each role available in OZmap. For this example, we will assign the user the "Manager" role, which has the ID 5accf8f60ff2c819a4ffd38f
.
Creating the user:
With the project ID and role ID determined, you can now create the user. In this example the user will have access to all resources, which include OZmap, OZmob, Loki, and API. Here is the request to create the user:
If the user is successfully created, the API will return a 201 Created status and the following response: