Pendency Creation
Creating a pendency in OZmap is based on a specific pendency type and the association with responsible users and an owner. This process involves three main steps:
Obtaining the desired pendency type.
Listing users to define the responsible users and the pendency owner.
Creating the pendency using the collected information.
Below, we detail the steps to perform these operations with practical examples of API calls to OZmap.
Example
The following is an example of how to create a pendency in OZmap.
1. Obtain the Pendency Type
The first step is to list the available pendency types in OZmap to determine which one will be used. To do so, make the following API call:
curl --location -g --request GET 'https://example.ozmap.com.br:9994/api/v2/pendency-types' \
--header 'Authorization: <API Key>' \
The expected response for this request is:
{
"total": 2,
"count": 2,
"rows": [
{
"description": "Comum",
"color": "#ffdd00",
"name": "Comum",
"createdAt": "2022-10-10T13:03:05.948Z",
"updatedAt": "2022-10-10T13:03:06.140Z",
"id": "60b7d3373dbf377d14cd4544"
},
{
"description": "",
"color": "#ff1f1f",
"name": "Example",
"createdAt": "2024-08-22T12:41:32.100Z",
"updatedAt": "2024-08-22T12:41:41.551Z",
"id": "66c731fc50ce3b0014a61210"
}
],
"start": 0,
"limit": 25
}
In the example above, we identified the pendency type named "Example" with the ID 66c731fc50ce3b0014a61210
.
If it is necessary to create a new pendency type to associate with the pendency being created, this can be done with the following OZmap API call:
curl --location 'https://example.ozmap.com.br:9994/api/v2/pendency-types' \
--header 'Content-Type: application/json' \
--header 'Authorization: <API Key>' \
--data '{
"description": "Created as an example",
"color": "#ffdd00",
"name": "Example pendency type"
}'
If the pendency type is successfully created, the API will return a 201 Created status and the following response:
2. List Users
After determining the pendency type, it is necessary to list the system's users to identify the responsible users and the pendency owner. Use the following API call to retrieve the list of users:
The expected response for this request is:
In the example above, we identified:
Responsible user: "Example responsible" (ID:
5c3173ee4fe3a70016d05bcd
).Owner: "Example owner" (ID:
63456ff9443ee40013100ed2
).
3. Create the Pendency
With the information about the pendency type, responsible users, and the owner, it is possible to create the pendency. Specify the coordinates for its location and the project it belongs to (the project can be retrieved using the "project" property in Boxes and Properties in OZmap). Use the following API call to create the pendency:
If the pendency is successfully created, the API will return a 201 Created status and the following response: