r2 - 2015-12-18 - 21:21:53 - DeniseMcKinnonYou are here: TWiki >  Deployment Web > WebPreferences > ClmCurlUtilitySh

Use ClmCurlUtility.sh to access CLM server functions from a command line.

Authors: ErikMats
Build basis: 4.0.3, 6.0.

ClmCurlUtility.sh is a script that allows you to access POST, GET, PUT, DELETE operations on a CLM server from a command line. It handles logins and cookie management (for X-Jazz-CSRF-Prevent).

The script uses "Curl" on Cygwin (Windows) or Linux systems.

It allows you to automatically iterate to create N users or projects, which is handy for testing.

This script uses the same command line parameters as RqmUrlUtility. It does add an -iterations N option to run the same invocation N times. It adds special GET (stdout) and POST (stdin + stdout) options.

Unlike RqmUrlUtility, it does not require XML input.

Examples

# DB Ping time once
# 2>/dev/null means: disregard errors. Remove this from the end of the line to get more diagnostic output.
./ClmCurlUtility.sh -command GET -user jazzadmin -password jazzadmin -context ccm -filepath GET -url https://clm.example.com:9443/ccm/service/com.ibm.team.repository.service.internal.IServerConnectionStatusRestService/databasePingTime 2>/dev/null

# DB Ping time three times:
# -iterations 3 means: Run three times.
./ClmCurlUtility.sh -command GET -user jazzadmin -password jazzadmin -context ccm -filepath GET -url https://clm.example.com:9443/ccm/service/com.ibm.team.repository.service.internal.IServerConnectionStatusRestService/databasePingTime -iterations 3 2>/dev/null

# DB Ping time Jazz.net Sandbox:
# Just to make sure this works on multiple hosts
./ClmCurlUtility.sh -command GET -user jazzadmin -password jazzadmin -context sandbox02-qm -filepath GET -url https://jazz.net/sandbox02-qm/service/com.ibm.team.repository.service.internal.IServerConnectionStatusRestService/databasePingTime 2>/dev/null

# Create 50 users, Charlie10000 through Charlie10049
# Echo data fetched from a Firebug request body.
# The string REPLACEME will be replaced with the number of each iteration; 10000, 10001, ...
# -filePath POST causes DATA to be read from stdin, output to go to stdout.
echo "itemId=new&name=CharlieREPLACEME&userId=CharlieREPLACEME&emailAddress=CharlieREPLACEME%40clm.example.com&jsonRoles=%5B%22JazzUsers%22%5D&jsonLicenses=%7B%22add%22%3A%5B%5D%2C%22remove%22%3A%5B%5D%7D" | ./ClmCurlUtility.sh -command POST -user jazzadmin -password jazzadmin -context jts -filepath POST -url https://clm.example.com:9443/jts/service/com.ibm.team.repository.service.internal.IAdminRestService/contributor -iterations 50 2>/dev/null

# Get all QM project areas
# Link grabbed from Firebug log of performing the same operation in the web UI
# Note double quotes around a URL that contains "&".
# Output is saved to projectAreas.xml.
./ClmCurlUtility.sh -command GET -user jazzadmin -password jazzadmin -context qm -filepath projectAreas.xml -url "https://clm.example.com:9443/qm/service/com.ibm.team.process.internal.service.web.IProcessWebUIService/projectAreasPaged?hideArchivedProjects=true&owningApplicationKey=JTS-Sentinel-Id&pageNum=0&pageSize=1000" 2>/dev/null

The script

... to follow

System Requirements

Linux

Requires bash and Curl

Windows

Requires Cygwin with bash and Curl.
Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Contributions are governed by our Terms of Use. Please read the following disclaimer.
Ideas, requests, problems regarding the Deployment wiki? Create a new task in the RTC Deployment wiki project