Person-role link integration using the API
Documentation on how to integrate the link between person and role, using the Ronda senior X API.
General prerequisites
- Be authenticated in Ronda senior X;
- Have a person registered in Ronda senior X;
- Have a registered role in Ronda senior X.
Consult person-role link
- Call the serviceGET /person/{personId}/roles to consult the papers that the person already has;
- In the postman, the person's ID must be passed as a parameter in the URL: https://sam-api.senior.com.br/api/v1/person/{personID}/roles
Register an association between a person and a role
- Call the serviceGET /person/{id} to consult the person;
- In the postman, the person's ID must be passed as a parameter in the URL: https://sam-api.senior.com.br/api/v1/person/{personID}
- Call the serviceGET /person/{personId}/roles to consult the papers that the person already has.
To save the person-role link:
- Call the servicePOST /person/role;
- Pass the token to the Header;
- Pass the JSON in the Body;
- Assemble the JSON with the link data. The person's ID, the role ID and the start date are mandatory. The end date is optional.
Note
The start and end dates must have the following format: "2017-03-24T10:09:00-03:00".
Json example:
{
"id": 0,
"personId": 29,
"roleId": 2,
"startDate": "2017-03-24T10:09:00-03:00"
}
Return Json example (status 200):
{
"id": 35, (Id PersonRoleLink)
"personId": 29,
"roleId": 3,
"startDate": "2017-03-24T10:09:00-03:00",
"endDate": ""
}
Delete the link between a person and a role
- Call the serviceDELETE /person/role/{personRoleId};
- In the postman, the person's ID must be passed as a parameter in the URL: https://sam-api.senior.com.br/api/v1/person/role/{personRoleLinkID}.
If the service returns successfully (HTTP 200), there will be no JSON returned.
Modify the person-role link
If the start date of the person-role link is earlier than the current date and time, only the end date of the role can be changed.
{
"id": 39,
"personId": 29,
"roleId": 2,
"startDate": "2017-03-24T10:52:00-03:00",
"endDate": "2017-03-25T14:50:00-03:00"
}
If the service returns successfully (HTTP 200), there will be no JSON returned.
Service information
Implementation Notes
Returns all roles from a person
Response Class (Status 200)
Returns all roles from a person
[
{
"roleId": 0,
"roleName": "string",
"personRoleId": 0,
"startDate": "string",
"endDate": "string",
"isSuspended": true
}
]
Parameters
| Parameter | Description | Parameter Type | Data Type |
|---|---|---|---|
| token | Authentication token | header | string |
| personId | ID of the person | path | long |
Response Messages
| HTTP Status Code | Reason | Response Model |
|---|---|---|
| 401 | Token is invalid or expired | |
| 404 | Person not found | |
| 500 | Server error | { "code": 0, "message": "string" } |
Implementation Notes
Returns a person
Response Class (Status 200)
Returns a person
{
"id": 0,
"name": "string",
"documents": [
{
"id": 0,
"documentType": {
"id": 0,
"name": "string",
"label": "string",
"mask": "string",
"required": true,
"documentToREP": true
},
"document": "string"
}
],
"emails": [
{
"id": 0,
"preferential": true,
"emailAddress": "string"
}
],
"phones": [
{
"id": 0,
"preferential": true,
"ddi": 0,
"phoneNumber": "string",
"extensionLine": "string"
}
],
"gender": 0,
"birthday": "string",
"registry": "string",
"registerDate": "string",
"lastModificationDate": "string",
"address": "string",
"number": "string",
"district": "string",
"city": "string",
"uf": "string",
"cep": "string",
"nationality": "string",
"lastAccessDate": "string",
"situation": 0,
"hasValidRole": true,
"hasProvisoryRole": true
}
Parameters
| Parameter | Description | Parameter Type | Data Type |
|---|---|---|---|
| token | Authentication token | header | string |
| id | ID of the person | path | long |
Response Messages
| HTTP Status Code | Reason | Response Model |
|---|---|---|
| 401 | Token is invalid or expired | |
| 404 | Person not found | |
| 500 | Server error | { "code": 0, "message": "string" } |
Implementation Notes
Associates a person with a role
Parameters
| Parameter | Description | Parameter Type | Data Type |
|---|---|---|---|
| token | Authentication token | header | string |
| personRole | Person-role link | body | { "id": 0, "personId": 0, "roleId": 0, "startDate": "string", "endDate": "string" } |
Response Messages
| HTTP Status Code | Reason | Response Model |
|---|---|---|
| 200 | Role associated with person | |
| 401 | Token is invalid or expired | |
| 403 | Operation denied | |
| 500 | Server error | { "code": 0, "message": "string" } |
Implementation Notes
Deletes a person-role link
Parameters
| Parameter | Description | Parameter Type | Data Type |
|---|---|---|---|
| token | Authentication token | header | string |
| personRoleId | ID of the person-role link | path | long |
Response Messages
| HTTP Status Code | Reason | Response Model |
|---|---|---|
| 200 | Association between person and role deleted | |
| 401 | Token is invalid or expired | |
| 403 | Operation denied | |
| 404 | Person/Role not found | |
| 500 | Server error | { "code": 0, "message": "string" } |
Implementation Notes
Updates a person-role link
Parameters
| Parameter | Description | Parameter Type | Data Type |
|---|---|---|---|
| token | Authentication token | header | string |
| personRole | Person-role link | body | { "id": 0, "personId": 0, "roleId": 0, "startDate": "string", "endDate": "string" } |
Response Messages
| HTTP Status Code | Reason | Response Model |
|---|---|---|
| 201 | Association between person and role updated | |
| 401 | Token is invalid or expired | |
| 403 | Operation denied | |
| 500 | Server error | { "code": 0, "message": "string" } |





