Search This Blog

Breaking

Tuesday, 31 August 2021

August 31, 2021

Git -> Taking clone from a specific remote branch and raising PR request to that branch

It might be that sometime in a project, someone will say, you to take a clone from a specific branch (not from master) and will request you to push your changes or raise PR for that branch. In such situation, below commands can help you:

1. First check all the branches in remote 

git branch -r

It will show you all the branches available in remote. It should have the requested branch also.


2. For example, here I am creating a new branch development.


3. Now when I will do git branch -r , then it will show me this branch. (Git pull is pre-requisite here)


4. Now what I will do is, I will create a local branch which will point to development branch.

git branch development_deepak origin/development


What it does is:
It creates a local branch with the name specified by you which will track the remote branch specified by you. 

Note: It does not switch to that newly created branch. You still remains in master.

5. Now you need to switch to that created branch.

git checkout development_deepak (my local branch)

6. Now in this branch, when you will push, then there are 2 options:

1-> If you want to create a branch in remote (same local branch name), then use : (Recommended)

git push origin HEAD

What it will do, is create a branch in rmeote with your changes. Now you can raise your PR for this branch changes.




2->  git push origin HEAD:development


It will directly push the changes to the remote branch you were tracking. (If you have the permission)





Monday, 30 August 2021

August 30, 2021

[ WorkFront ] Workfront API for Task creation, status change, upload document, folder create, project create/conversion

 In my last project, I worked on a SAAS tool "Workfront". Workfront provides a software-as-a-service platform for enterprise workflow management, project and portfolio management, resource management and individual task management. Workfront's platform automates and repeatable processes and allows users to manage financial information and create reports.

When I got an opportunity to automate our customized Workfront application, I learned a lot about Workfront API's. This article is about my learning of those API's (Which I could not find easily in internet).

If you are also in such a situation, then the first step to start understanding Workfront API's are Workfront API documentation page. Here, you will get a lot of information about Workfront objects and their API details.



So When I started working on it, I started with one of my Workflow. Let me describe my workflow a bit:

1: Create a request (Task)

2. Validate all field presence in request

3: Change it's assignment and add a user 

4: Change its status

5. Convert it to a project 

6. Validate project having the same data which we submitted at the time of request creation

7. Validate that the converted project is having the same task list which is already defined for this task template

8. Add document to project

9. Mark all the task as complete in Workfront

So to perform this workflow, I picked Workfront API's. To work on Workfront API, first I created an appKey. Take help from your team who manages Workfront accesses.


Between, below is the point for creating/getting the appkey:

1. Create an appkey for new user:

Method: Put

Path: /attask/api/v9.0/user

Params: action: generateApiKey

Param: username: username

Param: password: password

Param: method:put

2. Get an alredy created appkey for a user:

Method: Put

Path: /attask/api/v9.0/user

Params: action: getApiKey

Param: username: username

Param: password: password

Param: method:put


Once you will have the appkey, for creating a request, you can use /OPTASK endpoint.

1. Create Request/Task End Point

Method: Post

Path: /attask/api/v9.0/

Params: appKey

Body: Request Body

2. Validate all field presence in request:

Method: Get

Path: /attask/api/v9.0/

Params: appKey : appkey value

Params: ID : requestID

Params: fields : *

3Change it's assignment and add a use

Method: Put

Path: /attask/api/v9.0/

Params: appKey : appkey value

Params: ID : requestID

Body: Request body containing userid

4. Change its status

 Method: Put

Path: /attask/api/v9.0/

Params: appKey : appkey value

Params: ID : requestID

Params: status: RPC (Ready for project conversion)

5. Validate Project Creation:

 Method: Get

Path: /attask/api/v9.0/project/search

Params: appKey : appkey value

Params: name : requestname

fields: *

6. Get all task for a project:

 Method: Get

Path: /attask/api/v9.0/task/search

Params: appKey : appkey value

Params: projectID: projectID

7. Get all task from a template:

 Method: Get

Path: /attask/api/v9.0/templateTask/search

Params: appKey : appkey value

Params: templateID: templateIDValue

8. Create a folder: (Later add document to it):

 Method: Post

Path: /attask/api/v9.0/docfdr

Params: appKey : appkey value

Params: name: docFolderName

Params: userID: userIDValue

9. Add document to folder

 Method: Post

Path: /attask/api/v9.0/document

Params: appKey : appkey value

Body: Request body containing file information

10. Mark all the task as complete in Workfront

 Method: Get

Path: /attask/api/v9.0/task/

Params: appKey : appkey value

Params: projectID: projectIDValue

Param: name: projectName

Param: taskNumber: taskNumberValue

Param: percentComplete:percentCompleteValue


While Doing this activity, I explored many other Workfront end points also. This I will update in some time.