First I have some gerrit understanding in bit and pieces.
What I want is by using gerrit change url : -
http://review.xx.yy.com/gerrit/#/c/240262/
I want to get URL of the gerrit server and gerrit refspec (refs/changes/..) by using REST API's (using curl) or any other git commands.
Is it possible ?
Please comment/edit if question is not clear.
Thanks.
Gerrit has a REST api that you can query.
To get information about the Gerrit server you can use:
http://review.xx.yy.com/gerrit/config/server/info
You could use curl like this:
curl -i -H "Accept: application/json" http://review.xx.yy/gerrit/config/server/info
If you want to query change-sets you can use a form like this:
http://review.xx.yy.com/gerrit/changes/?q=owner:johndoe
Here is the documentation for Gerrit's REST API: https://review.typo3.org/Documentation/rest-api.html
Related
I want to look up some review comments on Gerrit via the REST API.
I tried a few methods, including Gerrit's official documentation, and nothing changed the fact that I was an anonymous user. The authentication configuration in the gerrit.config is as follow:
[auth]
type = LDAP
gitBasicAuthPolicy = LDAP
I'm calling rest api by curl
$ curl --digest --user LDAP_user:LDAP_password \
https://gerrit.example.com/a/path/to/api
It does not work.
Digest authentication was removed from Gerrit in release 2.14. Remove the "--digest" parameter and the "curl" command will work.
More info in Gerrit 2.14 release notes here.
HTTP_PASSWORD maybe the answer which can be found in account settings.
And then
curl -u USR_NAME:HTTP_PASSWORD https://gerrit.XX.com/a/path/to/api
What's your Gerrit version?
2.14 and newer require basic auth, as already mentioned by Marcelo (maybe you have to explicitly give --basic ).
2.13 and older use digest; you will also be interested in this post if you are using versions that old.
Can some one explain what is the exact query for the below in GERRIT REST API to get all the information
http://review.xx.yy.com/gerrit/#/c/2401262/
Execute the following command to get all information about 2401262 change:
curl --user USER:PASS --request GET http://review.xx.yy.com/a/changes/2401262
Has anyone been able to use the WebSphere Liberty REST API to deploy remote Docker containers? The docs describe all the steps, but I am not able to repeat the results. I get an error when calling REST deploy function (details are posted on the other forum).
If anyone was able to do it - please let me know and would be great if you share how you were able to do it.
Not long after posting this question I tried using the curl command with the JSON header spec and now it works. Here is the curl command I am using that works:
curl --verbose --insecure -X POST --data #docker_deploy.json --header "Content-Type: application/json" -u ${ADMIN_USER}:${ADMIN_PASSWORD} https://${CONTROLLER_HOST_NAME}:${CONTROLLER_PORT}/ibm/api/collective/v1/deployment/deploy
I couldn't find anything even remotely related in the documentation.
Using the Bitbucket website you can rename a repo as follows:
Go to the repo's overview page, usually https://bitbucket.org/username/oldname/overview
Click the settings cog on the far right end of the menu row !
Instead of 1. and 2. you can type 'r' then 'a' for administration.
Change the name in the Name field.
Click Save repository details.
Be advised that changing the name of the repo will change its URL access too. Previously the access was https://username#bitbucket.org/username/oldname.git Now, however, the repo's URL/Path will be https://username#bitbucket.org/username/newname.git
You can check this by going back to the Overview page, and hovering over the big blue HTTPS button. The bottom of your browser will show that it now points to https://username#bitbucket.org/username/newname.git
If you are using SourceTree you can update the remote's URL by highlighting the local repo in SourceTree and then
Click Repository
Click Repository Settings...
Highlight the row containing the remote branch. Usually origin https://username#bitbucket.org/username/oldname.git
Click Edit
Update the URL/Path field. Change 'oldname.git' to 'newname.git', leave the rest unchanged. So the full path should be https://username#bitbucket.org/username/newname.git
Click OK
For version 2.0 of the API:
According to https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-put
PUT https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug} --data "{\"name\": \"${new_name}\"}"
Using the PUT method allows renaming of a repository.
For version 1.0 of the API:
According to https://confluence.atlassian.com/display/BITBUCKET/repository+Resource+1.0:
PUT https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug} --data "name=new name"
This allows to update the visible name of a repository.
In a unix shell you can use cURL;
curl https://api.bitbucket.org/1.0/repositories/{accountname}/{old_repo_name} --data "name=new_repo_name" -X PUT
Is it possible for a user to authenticate in private repositories, but still have only administrators able to execute:
curl https://USER:PASS#api.bitbucket.org/1.0/repositories/{accountname}/{old_repo_name} --data "name=new_repo_name" -X PUT
Just in case anyone hits this with looking for a solution to an old version of the bitbucket API (in my case 5.14.0) to say the documentation on this version is lacking is being quite polite.
curl --location --request PUT 'https://git.local.install/rest/api/1.0/projects/aa/repos/my-repo' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic .....' \
--data-raw '{"name":"my-new-name"}'
According to the lastest API here is the correct curl command:
curl -X PUT --user username:password https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug} --data "name=newRepoName"
Note that the repo_slug is the repository name IN LOWER CASE. If you don't put it all in lower case you would get the not so expressive answer "Not Found".
If you are not sure what is the repository slug execute the following command, which shows you the user's information including current repositories, and look for the field "slug"
curl --user username:password https://bitbucket.org/api/1.0/user
From facebook graph api docs this is curl request i need to make. From console its working. Now I want to move this post in delayed job. How can I do this:
curl -F 'access_token=xxxxxxxxx' \
-F 'photo=http://xxxxxx.com/photos/13' \
'https://graph.facebook.com/me/my_app_namespace:upload'
PS: I have token etc everything. I just want to code this curl request in ruby.
For quick and dirty, just send the command to the shell with tics or system.
For a more elegant and efficient (having native bindings) solution, use curb Ruby gem.
Curb (probably CUrl-RuBy or something) provides Ruby-language bindings for the libcurl(3), a
fully-featured client-side URL transfer library. cURL and libcurl live
at http://curl.haxx.se/ .
Net::HTTP should be all you need for a simple request like this