Found this content helpful? Log in or sign up to leave a like!

Toggling planner items complete, then incomplete, then complete fails… ideas?

Jump to solution
DeletedUser
Not applicable

I've built a small tool to let students work more directly with Planner Items in their calendar, but I'm noticing a couple of things that I'm hoping someone else has already encountered and has some tips on working with.

On the face of it, calling the planner overrides API lets me mark planner items as complete or incomplete. But I've noticed that there's a limited amount of toggling back and forth that's available. I've encountered two scenarios:

  1. A planner item has no override, so I create one and mark the item complete. Then, when I toggle it incomplete I update the override. Then I mark it complete again by updating the override, but the update doesn't "stick" -- it stays in the incomplete state.
  2. A planner item has no override, so I create one and mark the item complete. Then, when I toggle it incomplete I delete the override. Then I mark it complete again by creating a new override, but I get an error that the item has "already been claimed".

Neither of these works terribly well for my purposes. Is there a flow to reliably toggle a planner item complete/incomplete without running out of opportunities to update it?

Labels (1)
1 Solution
DeletedUser
Not applicable
Author

Looks like the issue was somewhere in my own code. Of course. I'm a little hazy on the _why_ (a complete rewrite of the relevant code using the same design resulted in working code), but I _think_ it may have had to do with not explicitly setting my Content-Type header (or, alternatively, sending too many _extraneous_ headers).

In any event, the working code is here: my JavaScript SPA is sending API requests to my PHP back-end, which is using a user-authorized token to proxy the requests to the Canvas API. Works a treat right now!

View solution in original post

0 Likes