AnsweredAssumed Answered

How do you remove a date from an assignment via the API?

Question asked by cesbrandt on Oct 5, 2018
Latest reply on Oct 8, 2018 by cesbrandt

Should be a fairly straight-forward thing, right? Want to remove a setting, make it null. Well, that doesn't work with assignment dates.


So, I can change discussion[due_at], discussion[unlock_at], or discussion[lock_at] at PUT /api/v1/courses/:course_id/discussion_topics/:topic_id or quiz[show_correct_answers_at], quiz[hide_correct_answers_at], quiz[due_at], quiz[unlock_at], or quiz[lock_at] at PUT /api/v1/courses/:course_id/quizzes/:id to null without any issue. The values update without error and the UI continues to display/function as expected.


However, if I try changing assignment[due_at], assignment[unlock_at], or assignment[lock_at] at PUT /api/v1/courses/:course_id/assignments/:id it'll err with:

Invalid datetime for %{attribute}


What I find most odd is that when making the exact same change via the UI, it submits null for these values to the exact same API point without error. I haven't been able to identify what the difference is between my sending it via my own API call and the UI sending it, other than the inherent referrer data, nor have I been able to identify via the GitHub source why it would be valid for the UI to submit it.


Any ideas?


Updated 2018-10-05 10:18 GMT-5

I'm tried running the most simplistic jQuery AJAX call I could for it, using all static values, and I still get the errors:

     type: 'PUT',
     url: '/api/v1/courses/104/assignments/2057',
     data: {
          assignment: {
               unlock_at: null,
               lock_at: null