Consents
Create consent
To create a consent use the following endpoint: POST /api/Consent
Input
//POST /api/Consent
{
"agreementGroupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"consentGroupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userIp": "string",
"externalID": "string",
"environment": 0,
"screenshot": "string",
"clauses": [
{
"tag": "my_tag",
"accepted": true
}
],
"fieldCollection": {
"name": "name",
"surname": "surname",
"email": "name.surname@gmail.com"
}
}
Field | Description |
---|---|
AgreementGroupGuid | Agreement group connected to the consent |
ConsentGroupGuid | This parameter is used if you want to update a previously expressed consent. If you create a new consent or you don't need to modify a previous consent, it can be set to null or to an empty guid. If the agreement feature "Can this agreement be modified?" isn't enabled, this value will be ignored |
UserIp | The IP address of the user |
ExternalId | The key used in your software that represents the user |
Environment | 0: staging, 1: production |
Screenshot | Byte array of an image corresponding to the consent. If the agreement feature "Capture Screenshot" isn't enabled, this value will be ignored |
Clauses | The list of conditions set in the agreement |
FieldCollection | A JSON where the recipient information is saved or other information you might want to save and associate with the consent |
Output
{
"guid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"agreement": {
"version": "string",
"enviroment": 0,
"groupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"nameOfAgreement": "string"
},
"fieldCollection": "string",
"consentDate": "2023-05-03T10:35:07.421Z",
"platform": "string",
"userIdentifier": "string",
"clauses": [
{
"tag": "my_tag",
"accepted": true
}
],
"agreementHash": "string",
"externalID": "string",
"consentGroupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"screenshot": "string",
"userIp": "string"
}
Field | Description |
---|---|
Guid | The auto generated consent guid |
Agreement | The agreement linked to the consent |
Agreement.Version | The version of the agreement |
Agreement.Enviroment | 0 = staging, 1 = production |
Agreement.GroupGuid | Unique identifier that binds all the versions of a specific agreement |
Agreement.NameOfAgreement | Name of the agreement |
FieldCollection | The same collection as input |
ConsentDate | Creation date of the consent |
Platform | Platform on which the consent is created (Windows, Android, Macintosh, iPhone, iPad, BlackBerry, CrOS, Linux, Symbian, Others) |
UserIdentifier | Identifier of the user who has given the consent; it is automatically extracted from the field collection if there's a field named "email" or "mail" or "e-mail", otherwise it will be saved as an empty string |
Clauses | The same collection as input |
AgreementHash | The hash that will be sent on the blockchain |
ExternalID | The same as input |
ConsentGroupGuid | Auto generated guid, useful to modify a consent with this API |
Screenshot | The same as input |
UserIp | The same as input |
Get consents
To get the consents you use the following endpoint: POST /api/Consent/List
Input
//POST /api/Consent/List
{
"agreementGroupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"externalID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userIdentifier": "string",
"dateFrom": "2020-04-01T00:00:00.0000000",
"dateTo": "2030-04-01T00:00:00.0000000",
"platform": "string",
"enviroment": 0,
"version": "string",
"getScreenshot": true,
"page": 1,
"itemsPerPage": 20
}
Field | Description |
---|---|
AgreementGroupGuid | If set, retrieves the consents related to this specific agreement group guid |
ExternalId | If set, retrieves the consents related to this specific ExternalId |
UserIdentifier | If set, retrieves the consents related to this specific UserIdentifier |
DateFrom | If set, retrieves the consents created starting from this date |
DateTo | If set, retrieves the consents created up to this date |
Platform | If set, retrieves the consents of this specific platform |
Enviroment | If set, retrieves consents of a specific environment (0: staging, 1: production) |
Version | If set, retrieves consents related to a specific version of the agreement |
GetScreenshot | If set, retrieves the screenshot linked to the consent |
Page | Page number |
ItemsPerPage | Items per page |
The only required parameters are page
and itemsPerPage
.
The result collection doesn't include consents related to deleted agreements.
The output is a list of consents corresponding to the search crtiteria.
Output
[
{
"guid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"agreement": {
"version": "string",
"enviroment": 0,
"groupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"nameOfAgreement": "string"
},
"fieldCollection": "string",
"consentDate": "2023-05-03T10:55:32.675Z",
"platform": "string",
"userIdentifier": "string",
"clauses": [
{
"tag": "my_tag",
"accepted": true
}
],
"blockchainProcessId": "string",
"blockchainTxHash": "string",
"agreementHash": "string",
"blockchainStatus": 0,
"blockchainStatusDate": "2023-05-03T10:55:32.675Z",
"externalID": "string",
"blockchainUuid": "string",
"screenshot": "string",
"consentGroupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userIp": "string"
}
]
Field | Description |
---|---|
Guid | The auto generated consent guid |
Agreement | The agreement linked to the consent |
Agreement.Version | The version of the agreement |
Agreement.Enviroment | 0 = staging, 1 = production |
Agreement.GroupGuid | Unique identifier that binds all the versions of a specific agreement |
Agreement.NameOfAgreement | Name of the agreement |
FieldCollection | The JSON given as input in the integrator's APIs or compiled by the user with the required field in the website snippet |
ConsentDate | Consent creation date |
Platform | Platform on which the agreement is created (Windows, Android, Macintosh, iPhone, iPad, BlackBerry, CrOS, Linux, Symbian, Others) |
UserIdentifier | Identifier of the user who has given the consent; it is automatically extracted from the field collection if there's a field named "email" or "mail" or "e-mail", otherwise an empty string |
Clauses | The clauses list |
Clauses.ClausesTag | The tag you have created in the agreement |
Clauses.ClausesAccepted | If the user accepted or denied |
BlockchainProcessId | The id of the process on the blockchain |
BlockchainTxHash | The final hash that represents the success on the consent save on the blockchain (the blockchain may take a bit of time and it may not be valorized immediately after the creation of a consent) |
AgreementHash | The agreement hash that will be sent on the blockchain |
BlockchainStatus | Save status on the blockchain (Registered = 0, Queued = 1, ProcessCreated = 2, Notarized = 3, Error = 4) |
BlockchainStatusDate | When the status of the save on the blockchain changes |
ExternalID | The key used in your software that represents the user |
BlockchainUuid | UUID generated by the blockchain |
Screenshot | The screenshot generated by creating a consent, if in the agreement the option Capture screenshot is flagged. If there's no screenshot the output is an empty byte array. |
ConsentGroupGuid | Group guid of the consent |
UserIp | The IP address of the user |
Get audit trail PDF
To get the audit trail PDF document you can use the following endpoint:
GET /api/Consent/GetAuditTrail/{consentGuid}
Output
The Audit Trail PDF file.