gerrit query REST API vs. gerrit query API - gerrit

I found we can use gerrit query api to query as below:
ssh -p 29418 gerrit.review.com gerrit query --format JSON --current-patch-set status:open MY-JIRA
But I found another python module pygerrit2 as well, I guess this module is using REST API, which one is more better for user? How can I translate above command to REST API if possible!
I try below but doesn't work:
mylst = rest.get("/changes/?q=status:open%20current-patch-set%20{}".format(jira))

Related

Does the docker version of opennms have Rest API?

I am building a frontend-like for OpenNMS and chose to install OpenNMS in a docker container. I need to use the Rest API to further my project and when I try to send a request to
http://localhost:8980/opennms/rest, using the python requests library the return code is 404.
Does OpenNMS for docker not have Rest API or do I need to install it on my core system instead of docker.
P.S. This is my first time trying to do use the Rest API of an application.
imgur link : https://imgur.com/5UDPjRF
The URL you are calling is just the base URL for our rest resources. For Nodes as an example, you can test this with curl -u admin http://localhost:8980/opennms/rest/nodes. The REST API endpoints are described in the documentation here

How to consume Jenkins API Rest in Google Kubernetes Engine from external clients

I want to try out continuous deployment with Jenkins on Google Kubernetes Engine. Of course, by using the Jenkins API Rest.
I have gone through https://cloud.google.com/solutions/jenkins-on-container-engine-tutorial
I got Jenkins running. The problem is with regard to the Jenkins API Rest when I try to consume it by using Postman or curl. I'm prompted to Sign in to continue to Google Cloud Shell.
By using curl
curl -X GET https://8080-dot-3828316-dot-devshell.appspot.com/job/dev.ci/api/json\?pretty\=true --user USER:TOKEN
Found.
In Postman
In incognito window
My problem was related to the fact that I didn't expose the service properly. I was using the preview URL that Google provides you. So I had to follow the architecture shown here: https://cloud.google.com/solutions/jenkins-on-kubernetes-engine?fbclid=IwAR19Dl_kUSGzK1cfqyYA1s9cNt26CBnSgXf6zV104NGtIiXNtpTTKrfo3TI. I had to expose my jenkins ui as a NodePort and learn about ingress.

How to include credentials using bitbucket webhooks

I am using this interface:
If I want to ping our Jenkins server, we need credentials to do, for example with cURL it would look like:
curl -u ${user}:${password} http://jenkins.teros.io/job/demo/build?token=demo_interos_token
so is there a way to pass creds somehow with the webhook interface or maybe in the query parameters?
I created a middleman server, and Bitbucket can ping our server with creds in the url and we forward request to Jenkins.
You should be able to give the credentials as part of the URL:
http://<user>:<password>#jenkins.teros.io/job/demo/build?token=demo_interos_token
This is based on RFC-1738 which defines the URL Syntax, and specifically the Common Internet Scheme Syntax.

Triggering Jenkins builds from Slack

By following the tutorial below I am attempting to use slash commands in Slack to trigger a build in Jenkins. My jenkins instance which is on an EC2 is utilizing the user's API token to authenticate the POST command from slack.
When I do the curl command locally, it successfully triggers the build, the command is similar to this:
curl -X POST http://slack:c1c54d626f6a11fbc98ed795ec8862bc#10.11.12.13:8080/job/TEST_ATOMATION_GURU_SLACK_JOB_DEMO/build
However when I try to execute the command in slack via a slash command I get: Darn - that slash command didn't work (error message: 403_client_error).
Tutorial I am following: http://www.testautomationguru.com/jmeter-selenium-webdriver-how-to-trigger-automated-test-execution-from-slack/
I have also tried this tutorial with the same result:
https://sonnguyen.ws/how-to-trigger-a-jenkins-build-from-slack/
I also saw this stackoverflow post but it did not help: Using Slack to start Jenkins builds
Things I have tried:
- Opening up the security groups
- In jenkins selecting “Allow anonymous read access”
- In Jenkins deselecting “Prevent Cross Site Request
Forgery exploits”
Any help or guidance would be much appreciated.
enter image description here
The good news is that the setup should work - I also have a Slack slash command triggering a jenkins job, so the issue will be somewhere in your setup.
I see in your curl example you are accessing jenkins on a private IP. I would start there as if you are using the same private IP in the Slack slash command, there is no way Slack would be able to access your Jenkins instance. If you are using private IP in the slash command, I would recommend attaching an Elastic IP to your EC2 instance (assuming it lives in public subnet etc) and then try again the slash command but on the Elastic IP this time.
you can use ngrok for the tunneling and then you should be able to trigger that.
note: Ensure that the URL you are giving in the section should be able to trigger the build if run manually using the curl -X POST command.

Neo4J - Run dbinfo command from REST API

I want to run the
dbinfo -g "High Availability"
command over the Neo4J API. Does such an endpoint exist?
The neo4j doesn't provide endpoint for dbinfo -g.
for High Availability (HA), Its provides three REST endpoint
/db/manage/server/ha/master
/db/manage/server/ha/slave
/db/manage/server/ha/available
To check more on this read their official docs on HA.

Resources