How to start integrating two cloud services using Rest

72 Views Asked by At

I would like to understand where to start from, in the following scenario, when I would like to integrate two services which are (Workfront and Freshservice) both have Rest APIs.

For example, I have a ticket in Freshservice that has a Task within it to de-activate a user in Workfront, I would like the program to take the name of the user who needs to be deactivated, the username has to be taken from the header of the ticket and make an API call, a deactivation API call in Workfront, I just would like to understand how to get started in Python, any advice would be highly appreciated. I wrote the API calls for Python but I would like to have some direction and advice.

1

There are 1 best solutions below

0
codebrane On

From the documentation for deactivating a Workfront user you need to PUT data like this:

{
data: 
  {
    ID: "592125e60089b88fae8b51c08383e144",
    name: "Tyler Reid",
    objCode: "USER",
    isActive: false
  }
}

So you need to know the ID and name of the Workfront user.

You say

the username has to be taken from the header of the ticket

but you need the name to find the user in Workfront. If that's available in the ticket then you just search for the user using the Workfront API to get their ID, construct the above JSON and PUT it to the Workfront API to deactivate the user. If the name isn't in the ticket, perhaps the Freshservice API could be used to find it.

There appears to be a python Workfront API client you could have a look at for abstracting access to the Workfront API.

So the flow might be:

  1. Receive ticket from Freshservice.
  2. Parse ticket to get name. If the name isn't there, use the username to find the name from the Freshservice API (if available)
  3. Search Workfront with the name from Freshservice to find the user's Workfront ID
  4. Construct the deactivation JSON with the Workfront name and ID
  5. PUT the deactivation JSON to the Workfront API endpoint detailed in the link