Add a legal basis for user data processing

Add a legal basis for user data processing using POST.

Request

POST https://www.kursguiden.no/api/v2/privacy/users/:id/legalbases

For every API request you make, you'll need to present the API access key in the HTTP Header as X-API-Key to be authenticated.

Parameters

Name Required Value Description
legal_basis required integer Possible values as in Get Legal bases:
  • 1 = Consent
  • 2 = Contractual matters
  • 3 = Legal obligation
  • 7 = Protecting vital interests
  • 8 = Public interest
  • 9 = Legitimate interest
  • 11 = Withdrawn
purpose required integer See Get purposes for possible values
source required integer Possible values as in Get Data sources:
  • 1 = Changes made to My page
  • 2 = E-mail
  • 3 = Incoming request
  • 4 = Chat
  • 5 = Registration form
  • 6 = Booking module
  • 7 = Import
  • 8 = Other integration
  • 9 = Unknown
consent optional integer See Get consents for possible values
comment optional string

Example code in PHP

$post_params = array();
$post_params['legal_basis'] = '1';
$post_params['purpose'] = '112';
$post_params['source'] = '3';
$post_params['consent'] = '146';
$post_params['comment'] = 'Consent given via registration form';
$request_url = 'https://www.kursguiden.no/api/v2/privacy/users/154420/legalbases';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  'X-API-Key: {your-api-key}',
  'Accept: application/json',
));
$result = curl_exec($ch);
curl_close($ch);
               

Response

If the method is successful it responds with an JSON structure, as it is shown below.

{
    "id": 2911,
    "idLead": null,
    "consent": {
        "id": 146,
        "title": "Yes, I want e-mail about new courses once a week",
        "version": 1,
        "created_at": "2020-04-27T22:27:16+02:00",
        "updated_at": "2020-04-27T22:27:16+02:00",
        "deleted_at": null
    },
    "legal_basis": {
        "id": 1,
        "title": "Consent"
    },
    "purpose": {
        "id": 112,
        "title": "Marketing",
        "created_at": "2020-04-27T22:16:58+02:00",
        "updated_at": null,
        "deleted_at": null
    },
    "source": {
        "id": 3,
        "title": "Incoming request"
    },
    "comment": "Consent given via registration form",
    "created_at": "2020-04-27T22:34:58+02:00",
    "updated_at": "2020-04-27T22:34:58+02:00",
    "deleted_at": null,
    "idUser": 2911
}

Unsuccessful response sample:

{
    "error": "Wrong API Key"
}      
© 2024 FrontCore