Update a legal basis for user data processing

Update a legal basis for user data processing using PUT.

Request

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

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/2911';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($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.

<html><head><title>Slim Application Error</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{display:inline-block;width:65px;}</style></head><body><h1>Slim Application Error</h1><p>The application could not run because of the following error:</p><h2>Details</h2><div><strong>Type:</strong> ErrorException</div><div><strong>Code:</strong> 2</div><div><strong>Message:</strong> Undefined array key "HTTP_USER_AGENT"</div><div><strong>File:</strong> /data/kursguiden/www/unified/classes/class.courseuserprivacy.php</div><div><strong>Line:</strong> 231</div><h2>Trace</h2><pre><div>#0 /data/kursguiden/www/unified/classes/class.courseuserprivacy.php(231): Slim\Slim::handleErrors()</div><div>#1 /data/kursguiden/www/website/public/api/api_v2.php(1344): CourseUserPrivacy->update()</div><div>#2 [internal function]: {closure}()</div><div>#3 /data/kursguiden/www/website/public/api/Slim/Route.php(468): call_user_func_array()</div><div>#4 /data/kursguiden/www/website/public/api/Slim/Slim.php(1340): Slim\Route->dispatch()</div><div>#5 /data/kursguiden/www/website/public/api/Slim/Middleware/Flash.php(85): Slim\Slim->call()</div><div>#6 /data/kursguiden/www/website/public/api/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()</div><div>#7 /data/kursguiden/www/website/public/api/Slim/Middleware/AcceptJsonMiddleware.php(71): Slim\Middleware\MethodOverride->call()</div><div>#8 /data/kursguiden/www/website/public/api/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\AcceptJsonMiddleware->call()</div><div>#9 /data/kursguiden/www/website/public/api/Slim/Slim.php(1285): Slim\Middleware\PrettyExceptions->call()</div><div>#10 /data/kursguiden/www/website/public/api/index.php(170): Slim\Slim->run()</div><div>#11 {main}</pre></body></html>

Unsuccessful response sample:

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