Request A Demo
Back to All Blog Articles

Setup GIT Integrations in FlexDeploy using REST API

FlexDeploy has various REST API that can be used for many useful purposes. For example, you can create Topology configurations or execute Build and Deploy workflows using REST API. See details at FlexDeploy REST API Guide.

In this blog entry, I will demonstrate use of REST API to setup Git Integrations in FlexDeploy with inputs from CSV file. This task can be done from FlexDeploy UI, but it is good idea to use REST API to speed up the configuration process. We will use POST method of Source Control Management Instance API.

For example, I have prepared CSV file with 10 Git Integrations with columns for Code, Name and URL to be used in FlexDeploy Git Integration. In this example, I am using same user ID and password for all Git repositories but you can always adjust this script as necessary.

With FlexDeploy you can use REST API to setup Git Integrations.

Adjust run.sh file (shown below) for various properties like FD_HOST, FD_PORT, FD_USER, FD_PASSWORD, GITUSER and GITPASSWORD. When you run this script, it will invoke FlexDeploy REST API to create Git Integration configurations with data from scm.csv file.

Here is sample scm.csv file.

DEMO1,Demo1,https://github.com/flexagon9/demo1.git
DEMO2,Demo2,https://github.com/flexagon9/demo2.git
DEMO3,Demo3,https://github.com/flexagon9/demo3.git
DEMO4,Demo4,https://github.com/flexagon9/demo4.git
DEMO5,Demo5,https://github.com/flexagon9/demo5.git
DEMO6,Demo6,https://github.com/flexagon9/demo6.git
DEMO7,Demo7,https://github.com/flexagon9/demo7.git
DEMO8,Demo8,https://github.com/flexagon9/demo8.git
DEMO9,Demo9,https://github.com/flexagon9/demo9.git
DEMO10,Demo10,https://github.com/flexagon9/demo10.git

run.sh code that will use scm.csv file.

FD_HOST=fdtlt05.flexagon
FD_PORT=8000
FD_USER=fdadmin
FD_PASSWORD=welcome1

GITUSER=flexagon9
GITPASSWORD=pAssword

export IFS=","
cat scm.csv | while read CODE NAME GITURL
do
   echo Create FlexDeploy Git Connection using $CODE $NAME $GITURL
   curl -u $FD_USER:$FD_PASSWORD -i -X POST -H "Content-Type:application/json" http://$FD_HOST:$FD_PORT/flexdeploy/rest/v1/topology/integrations/scminstance -d '{"instanceName":"'$NAME'","properties":[{"propertyName":"FDGIT_URL","propertyValue":"'$GITURL'"},{"propertyName":"FDGIT_USER","propertyValue":"'$GITUSER'"},{"propertyName":"FDGIT_PASSWORD","propertyValue":"'$GITPASSWORD'"}],"scmType":"GIT","instanceCode":"'$CODE'","isActive":true}'
done

There are many possibilities with API, this was just a simple example for API usage.

DevOps and CI/CD Done Right

Out of the Box DevOps Platform for your Business and Open Systems

Related Resources

Unlock the Power of DevOps Compliance for Your Enterprise Software

In today’s fast-paced software development environment, ensuring compliance with regulatory standards and policies is not just a necessity—it’s a strategic ...

Integrating Tricentis Tosca (DEX) with FlexDeploy for Test Automation

Tricentis Tosca is a software testing tool that is used to automate end-to-end testing for software applications. Tricentis Tosca combines ...

Integrating ACCELQ with FlexDeploy for Seamless Test Automation

ACCELQ is a cloud-based, continuous testing platform that offers codeless test automation for web, mobile, API, desktop, and packaged applications. ...

Join DevOps leaders across the globe who receive analysis, tips, and trends in their inbox