Last updated 2 years ago
This API is used to update user consent for sharing the PII to an organisation, course or collection
/user/v1/consent/update
Consent update success response
const response = await fetch('https://staging.open-sunbird.org/api/user/v1/consent/update', { method: 'POST', headers: { "Authorization": "text", "x-authenticated-user-token": "text", "Content-Type": "application/json" }, body: JSON.stringify({ "request": { "consent": { "status": "ACTIVE", "userId": "e94ad69a-9096-491c-b107-782a67760a2b", "consumerId": 126632859575746560, "objectId": "do_31313966505806233613406", "objectType": "Collection" } } }), }); const data = await response.json();
{ "id": "api.user.consent.update", "ver": "v1", "ts": "2020-09-17 14:07:15:545+0000", "params": { "resmsgid": null, "msgid": "3d1afc39-9350-4565-afb3-735dbccd19c7", "err": null, "status": "success", "errmsg": null }, "responseCode": "OK", "result": { "consent": { "userId": "5a8a3f2b-3409-42e0-9001-f913bc0fde31" }, "message": "User Consent updated successfully." } }
const response = await fetch('https://staging.open-sunbird.org/api/user/v1/consent/read', { method: 'POST', headers: { "Authorization": "text", "x-authenticated-user-token": "text", "Content-Type": "application/json" }, body: JSON.stringify({ "request": { "consent": { "filters": { "userId": "5a8a3f2b-3409-42e0-9001-f913bc0fde31", "consumerId": 126632859575746560, "objectId": "do_31313966505806233613406" } } } }), }); const data = await response.json();
{ "id": "api.user.consent.read", "ver": "v1", "ts": "2020-09-17 14:11:19:029+0000", "params": { "resmsgid": null, "msgid": "dfb32305-cb9f-470a-b52b-fe492ca89415", "err": null, "status": "success", "errmsg": null }, "responseCode": "OK", "result": { "consents": [ { "userId": "5a8a3f2b-3409-42e0-9001-f913bc0fde31", "consumerId": 126632859575746560, "status": "REVOKED", "objectType": "Collection", "objectId": "do_31313966505806233613406" } ] } }