Sunday, September 22, 2019

#730 OIC - Google Tasks adapter

Here is a simple example of leveraging the adapter -

Naturally, I begin by creating the connection.

There are some pre-requisites for leveraging the google task api from OIC.
You need to create the OAuth credentials.
This you do via

I click Enable -

Now I click Create Credentials -

and generate the OAuth Client ID - (Client ID/ Client Secret)

I will also need to specify the scope - e.g. read only or read/write.

I add my client id and secret and then click Provide Consent -

I click Allow -

I now switch back to the OIC Connection definition and click Test and then Save.

Now to using it in an integration -

I have a REST interface with the following Request/Response -

{"taskList":"myTaskList", "taskName":"task", "description": "desc",
"dateDue": "2019-10-12T23:28:56.782Z"}

{"taskListId":"ABC", "taskId": "123"}

Essentially, I will be creating a new tasklist and adding a task to it.
The response contains the ID of tasklist and task.

I drop the google Task connection into the integration -

and select Insert Task List - this will add a new Tasklist to my existing list -

I then drop the google task adapter again and select Insert Task -
I will add the tasklist ID to the the Insert Task Request, to create the link between the two.

Maybe this is a good time to look at the task api docs here

So back to the integration -

Here is the mapping for createTaskList -

I set kind = "tasks#taskList"

title is set to the request field - taskList

Here is the mapping for createTask -

I set kind = "tasks#task"

Note how I set the tasklistId under TemplateParameters.
This appears under TemplateParameters because the url is as follows -

This is set to the ID returned by the createTaskList request.

I activate and test with the following payload -

{"taskList":"myTaskList", "taskName":"Important Task", "description": "sehr wichtig!", "dateDue": "2019-10-12T23:28:56.782Z"}

I check in Google Tasks -

No comments: