Add a username to a request for logging and auditing
It is possible to add a username to every request. This username is stored in the audit logs, so it can later be requested.
In order to have this functionality the Api-From
header needs to be used with all requests. When this header is set, it triggers the creation of an audit log entry. The value of the Api-From
header will be saved in the audit log.
This example is for a request that patches the company name.
curl --request PATCH \
--url "<<url>>:443/api/companies/me" \
--header 'Api-Version: 2' \
--header "Api-Sector: $sector_id" \
--header "Api-Application: $application_id" \
--header "Api-Company: $company_id" \
--header 'Content-Type: application/json' \
--header "Api-From: $user" \
--data '{"name":"New company name"}'
This would result in the following audit log entry:
{
"action": "UPDATE",
"request": {
"fromName": "$user"
}
}
Updated over 1 year ago