Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Repository in Fisheye

Manu Mishra
Contributor
July 3, 2018
Hi team,

Can please point me the API where we can Add Multiple repositories at once using REST. I have gone through the Fisheye/Crucible API documentation but that only describes Adding single single repositories. Basically we have more than 1000 repos in different instance of Fisheye which we want to migrate to new instace.

2 answers

0 votes
Josh Steckler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018

You will need to run that API for each repo, separately. You can build the script using curl commands in Excel. You'll run 1000+ curl commands, but since it's basically a one time loading it should be fine.

Manu Mishra
Contributor
July 5, 2018

@Josh Steckler

Below is the cUrl command i'll be using to add repo. Can you check if the below command will work?  Is the type(attribute) is case sensitive? 

 

curl -u XXXXX:XXXX -X POST --data '{"type":"SUBVERSION","name":"<display_name>","url":"<svn_ul>","path":"<path if exit>","username":"<user_name>"}' -H "Content-Type: application/json" http://crucble.mspot.com/rest-service-fecru/admin/repositories-v1/

 

Also can you confirm if we can add 1000+ commands like this in Shell script and execute? Will this add all the repos? 

Josh Steckler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 5, 2018

Yes, running that command separately, for each repo, will work. 

Type will be case sensitive. I would suggest running these one at a time until you know it works, and only then should you run the rest of the 1000+.

You'll have to look closely at the example data payload in the API document (linked earlier):

{
"type" : "svn",
"name" : "mySvnRepo",
"description" : "My SVN repo",
"storeDiff" : true,
"enabled" : true,
"svn" : {
"url" : "svn://svn.mycompany.com/myrepo",
"path" : "/amazingapp",
"auth" : {
"username" : "copernicus",
"password" : "sun123"
},
"blockSize" : 400,
"commandTimeout" : "1 hour",
"connectionsPerSecond" : 1.0,
"charset" : "UTF-8",
"accessCode" : "allow",
"startRevision" : 10000,
"initialImport" : "notags",
"followBase" : true,
"usingBuiltinSymbolicRules" : false,
"trunks" : [ {
"regex" : "trunk(/|$)",
"name" : "trunk"
}, {
"regex" : "core/trunk(/|$)",
"name" : "trunk",
"logicalPathPrefix" : "core"
} ],
"branches" : [ {
"regex" : "branches/([^/]+)",
"name" : "${1}"
}, {
"regex" : "core/branches/([^/]+)",
"name" : "core-${1}",
"logicalPathPrefix" : "core"
} ],
"tags" : [ {
"regex" : "(tags|releases)/([^/]+)",
"name" : "${2}"
}, {
"regex" : "core/tags/([^/]+)",
"name" : "core-${1}",
"logicalPathPrefix" : "core"
} ]
}
}
Manu Mishra
Contributor
July 5, 2018

@Josh Steckler Do I have to provide all the information after user_name & pass_wd mentioned above? Or the cRul command I mentioned will work? Can the username and password be same for all repositories? B/C I am an admin, so I am using my credentials. Will there be a problem if user try to access the repo?

Josh Steckler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 5, 2018

Not everything here is required, but remember you may be using two different usernames/passwords here.

In the curl -u username:password you're giving your fisheye user credentials

In the Json you're giving SVN credentials

 

 

I'm not exactly sure which fields are required.

0 votes
Josh Steckler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2018
Manu Mishra
Contributor
July 3, 2018

@Josh StecklerThis I already checked but it does not show up the how can I add multiple repositories at once. For example we have two repo (display name: Y, X) these are SVN repository and SVN URL for both are different. So how can I achieve this and add these two REPOSITORIES using POST method? 

Suggest an answer

Log in or Sign up to answer