what is the REST API query for http://review.xx.yy.com/gerrit/#/c/240262/ - gerrit

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

Related

msgraph teams api, filter for groups only with teams

I have a requirement to filter for teams which have a given string. To achieve that I found the following documentation https://learn.microsoft.com/en-us/graph/teams-list-all-teams. I cannot use the beta APIs, so the only option left for me as per this is to
Get all the teams using /groups?$select=id,resourceProvisioningOptions
Manually do the filtering
I am a bit worried that this could overload the server since I am loading a lot of data and then filtering, is there a better way to do this?
Also I tried the following curl command curl -H "Accept: application/json" -H "Authorization: Bearer token" -X GET "https://graph.microsoft.com/v1.0/groups?$select=id,resourceProvisioningOptions" -k but this returns all the fields like expirationDateTime, displayName and so on. Am I doing something wrong in this curl command
Please check below curl command
curl --location --request GET 'https://graph.microsoft.com/v1.0/groups?$select=id,resourceProvisioningOptions,displayName&$filter=startswith(displayName,%27abc%27)' \
--header 'Authorization: Bearer token'

How to get pull request approvals count via bitbucket API

I am trying to write a bash function which should return me the pull request approvals count using the PR ID. I know the below API URL will provide me with the whole body of pull request response in json.
I want to know if there is any other way to easily get through instead looping all the approvals in response body? Samples will help me. Please assist.
local getDetails=$(curl -w "status_code:%{http_code}\\n" -s -k -u "${User}:${Password}" -X GET "$BITBUCKET_URL/rest/api/1.0/projects/${projectCode}/repos/${repoName}/pull-requests/${prId}")
local resBody=$(echo $getDetails| sed -e 's/status_code\:.*//g')
curl -s 'https://bitbucket/rest/api/1.0/projects/{project}/repos/{repo}/pull-requests/{pr-id}/' --header 'Authorization: Bearer KEY'|jq '.reviewers[].approved'|grep true|wc -l
I used this solution to count current approvals in Jenkins, so according to this number I continue pipeline in a different ways.
The output should be the number of approvals for example: 0 if nobody approved, and 3 if there are 3 approves.

Using REST API to deploy Liberty Docker containers

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

Query Gerrit using REST API's?

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

DELETE requests directly from the command line

I'm following this tutorial http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#fnref-9_4 and after the code in Listing 9.44 author says that in that specific moment any user can be deleted with a direct DELETE request from the command line, of course I believe that it's true but I don't know how to check this one
any sufficiently sophisticated attacker could simply issue DELETE requests directly from the command line to delete any user on the site.
Here's an example of a command line DELETE call using cURL
$ curl -X DELETE http://localhost:3000/users/1
http://localhost:3000/ is the path to your app, 1 is the ID of the record to delete.
With cURL you can simulate the same requests you will perform using your browser. You can use any other HTTP client.
You can use cURL from the command line to make HTTP requests, including DELETE requests.
curl -i -H "Accept: application/json" -X DELETE http://localhost:3000/persons/person/1
** Adapted from this blog post

Resources