Skip to content

Technical

API / package

The consent API is used by both GDPR and Newsletter. Since it's a normal Python package, it can also be used as a dependency in an add-on or customer solution. Check out the unit tests for code examples and documentation.

Endpoints

The endpoints are used by the Bootstrap apps and future Web components, but could also be used for other purposes.

Used to find out the all available consent relations (and consenttypes) on a limetype

GET

/relation/<string:limetype_name>/

/relation/person/

Get all the information on a consent relation including consenttypes

GET

/relation/<string:limetype_name>/<string:consent_relation_name>/

/relation/person/consent/

Consent on a limeobject, no matter what consent relation

GET

/<string:limetype_name>/<int:owner_id>/

/person/1021/

Consent on a limeobject on a specific consent relation

GET

/<string:limetype_name>/<int:owner_id>/<string:consent_relation_name>/

/person/1021/consent/

Get the consent on a limeobject on a specific consent relation

POST

/<string:limetype_name>/<int:owner_id>/<string:consent_relation_name>/

/person/1021/consent/

Create (update if exists) the consent on a limeobject on a specific consent relation

The JSON payload must contain the id of the Consenttype. If a consent already exist for this consenttype (active or not), the consent will be updated instead of created. The created/updated consent will be in the response.

{
    "consenttype_id": 1001,
    "approved": true,
    "source": "coworker",
    "note": "Customer told me he wants our newsletter"
}

Get or update a consent by the id of the consent. The relation name must me known

GET

/<string:limetype_name>/<int:owner_id>/<string:consent_relation_name>/<int:consent_id>/

/person/1021/consent/1044/

Gets a specific consent by id.

PUT

/<string:limetype_name>/<int:owner_id>/<string:consent_relation_name>/<int:consent_id>/

/person/1021/consent/1044/

Update or "delete" a consent. Deleting a consent is the same as supplying approved=false. All properties are optional, properties not provided will retain their values. It is not possible to change the consenttype of an existing consent.

{
    "approved": true,
    "source": "coworker",
    "note": "An updated note"
}

Consents (bulk)

Bulk create consent on a specific consent relation on a specific limetype. Because writing to the database is slow, use batches of max 50 consent per request.

POST

/<string:limetype_name>/<string:consent_relation_name>/

/person/consent/
{
    "owner_ids": [1003, 1004, 1005, 1006, 1027, 737],
    "consenttype_id": 1002,
    "approved": false,
    "source": "newsletter",
    "note": "Bulk created"
}

Response:

{
    "created": [1027],
    "key": "consents_saved",
    "messages": "Consents saved",
    "not_found": [737],
    "unchanged": [1003, 1004, 1006],
    "updated": [1005]
}

Events