Search code examples
phpdesire2learnvalence

Valence API, Course Deletion Issue


I've been using valence for many years now, but have run into a wall and can't figure out the issue. I'm trying to delete a course but getting the Forbidden message.

This all worked fine and was tested and in production running nicely. No code was changed but now delete functionality does not work.

Adding courses, creating users, deleting users , enrolling users all works fine.

We are currently running:

  • Learning Environment Version: 10.5.0
  • Valance Version: 1.4
  • Valence SDK PHP Version: 1.6.0

Here is a code snippet of my delete request:

global $curl_options;
$func = new mphs_functions();
$admin = $func->mphs_authenticate_admin_access();
$ch = curl_init();
curl_setopt_array($ch, $curl_options);
switch($environment) {
    case 'none':
        $uri = $admin->createAuthenticatedUri('/d2l/api/'.$request, 'DELETE');
        break;
    default:
        $uri = $admin->createAuthenticatedUri('/d2l/api/'.$environment.'/'.VALENCE_VER.'/'.$request, 'DELETE');
}
curl_setopt($ch, CURLOPT_URL, $uri);                                                                
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
$response = curl_exec($ch);
//$response = json_decode($response, true);
curl_close($ch);
return $response;

Solution

  • Here is the response I got for this issue:

    Hello Ian,

    This Issue is being caused due to bug# PRB0049748 > Course Deletion > Users with Permission to Delete Courses cannot do so using the API

    This bug is currently being investigated by our Development Teams, unfortunately we do not have an eta on the fix yet, As a work around, you would need to delete the courses from the UI.
    Do let me know if you have any questions or concerns. Thanks

    My response:

    Deleting from the UI is not an acceptable solution this is a production application and would take many hours daily to manually delete each course.

    I need a eta on the fix, or another solution to the issue.

    Also where can the list of bugs and know issues you have posted 'PRB0049748'?

    There response:

    Hi Ian,

    The Bug is under review by our Development Teams, unfortunately we do not have > an eta on the fix yet.

    The list of bugs is not available to clients but is an internal list within D2L.

    Clients are provided with a list of bugs that have been fixed in a specific version in D2L Community.

    Our apologies for the inconvenience. Do let me know if you have any questions or concerns. Thanks

    Dead end, wish I could have know about the bug early I could have fixed the issue before hand. Same old same old.

    My Solution

    Any way the solution to the problem is simple, all I will do is unenrol the specify user from the course leave the delete function in place until it is fixed in some undefined future.

    Now all I have to do is contact every person that tried to delete a course in the past month and make sure they still want that course deleted. A lot of unneeded work on my plate next week!!