Here you can find the transcript of Episode #114 of PiaSys TechBites.
Welcome back to PiaSys Tech Bites. Today I want to talk with you about the To-Do APIs that Microsoft introduced under the beta endpoint of the Microsoft Graph. Using these APIs, we can easily access the list of task lists, the tasks in the task list, and the linked resources for a specific task. For all of these entities, we can have, create, read, update, and delete operations, as well as we have GET delta changes for the tasks. Moreover, and from a developer point of view, we can extend both the task list and the task with the Open Extensions of Microsoft Graph. So it is really powerful for developing custom solutions.
Like always, let me move to the demo environment, and let me show you how to play with these APIs in practice. So let’s start from the official documentation of the To-Do API, which you can find under the Microsoft Graph documentation in the beta section. In the To-Do tasks, preview topic in the list of topics right here.
And in there, you will find all of the documentation to play with the To-Do APIs. So let me do that for you. And in the Graph Explorer, let me switch to the beta endpoint, and let me ask to access the To-Do endpoint and to get the lists of lists of tasks that I have there. I make a GET request, and I will get back a collection of objects, including a bunch of lists of tasks. If I switch to my Microsoft To-Do, we can I see that I have a pre-existing Tech Bites demo list, which I already created, but actually you can create it using the Microsoft Graph, as well. And I can search for this one in the list of results that I’ve just got. So let me see where it is. And most likely here it will be.
So here it is, PiaSys Tech Bites demo. So let me get the ID of this item of this list of tasks, and let me apply the ID right after the lists endpoint. So I will be able to say, give me the tasks in this list of tasks. And we can see that, right now, it is an empty list. Well, we can easily add a new task. Let me put this screen just beside the To-Do app UI, so I can simply make a POST request to the target URL that we just saw, so the collection of tasks in the list.
And I will have to provide, as a JSON object, a task body in the body of the request. So I will have at least a title. I can provide a link resource for my task item, which will be just a reference to my website. And I can execute these request, targeting the bit endpoint of the graph. And you will see that, quickly, I will have a new task here, and right here it is, the demo task. So it has been created.
Now I can get it back. In fact, in the response, I have the ID of the task, which I can use if I want to go straight to this task. So let me do that. I have a collection of tasks. Let me append to the URL, the unique ID of the tasks that got created. And of course, I will have to make a GET request to get that task. And I will get back the JSON representation of my task with all of its information and resources.
Now, let’s say that I want to change the status of this task. For example, I want to declare that my task is now in progress because I’m working on it. So I can provide a JSON object in the body of my request. I can make a PATCH HTTP request targeting that specific endpoint, that specific task. And I can run my query.
By doing that, my task will be now in progress, and I can notify people that I’m working on it. But I can also mark the task as completed, if I like. So let me do that, completed, run query again, and patching the object. And as you can see, now, my task is completed in the UI of the To-Do app. So, really useful and easy to do.
Keep into account that you can play with your own tasks in To-Do. But if you have proper permissions, you can also replace the “me” with the user principal name of a target user for which you have access to the tasks in the To-Do application. So this is a really powerful API that you can leverage to automate the creation and the management of tasks in To-Do.
Thanks for watching this video. I hope you found it interesting and useful, and I’m really looking forward to seeing you next week. Thank you.