Bitcoin how to create a new account via RPC - exchange-server

I am running docker container with bitcoin node and want to create a new account, but I can't find good documentation about bitcoin RPC methods.

To create account using RPC run:
curl -H "Content-Type: application/json" --data '{"method": "getnewaddress"}' rpcuser:rpcpassword#ip:port
Or, you can specify account and get this address assigned to new address:
curl -H "Content-Type: application/json" --data '{"method": "getnewaddress", "params": ["billy"]}' rpcuser:rpcpassword#ip:port
I've found it here - Bitcoin cryptocurrency node administration guide
Also, if you running docker container don't forget to publish container's port (like docker run -p "127.0.0.1:8332:8332")

You can create a new Bitcoin address by running the following command:
bitcoin-cli getnewaddress
You can also do the same using cURL:
curl --user myrpcusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
More information here

Related

Synology chat incoming webhooks

I bought a Synology DiskStation and installed Synology chat (Version 2.4.0) on it.
According to Synology's documentation it should be possible to send data (e. g. a text) in Synology chat to a channel with incoming webhooks.
So I created an incoming webhook and wrote a shell-skript with curl to send text to my channel:
curl -k -X POST 'https://IP-ADDRESS:5001/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=THIS-IS-MY-TOKEN' -H 'Content-Type: application/json' -d '{"text": "This is a test"}'
However, when I execute the skript, it throws this error:
{"error":{"code":120,"errors":{"name":"payload","reason":"required"}},"success":false}
What I am doing wrong?
To post via curl this modification to your command worked for me: curl -X POST 'https://IP-ADDRESS:5001/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=THIS-IS-MY-TOKEN' -H 'Content-Type: application/json' -d 'payload={"text": "This is a test"}'

curl pull request error - fork_collab Fork collab can't be granted by someone without permission

I'm trying to automate github pull requests via bash script, specifically raising pull requests for forked branches. I've successfully done it for private repos, however it doesn't seem to work for public repos (see code below):
curl -H "Authorization: bearer <accesstoken>" -d '{"title":"SOMETITLE","base":"master","head":"'"someuser"':'"someForkedBranch"'","body":"some words to fill body."}' https://api.github.com/repos/<user-name>/<repo-name>/pulls
Any help would be appreciated.
If this is for creating a PR, you would need a -X POST somewhere in your curl command, in order to POST the query for a new PR:
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/octocat/hello-world/pulls \
-d '{"head":"head","base":"base"}'
Make sure also to use the right oauth/PAT or SAML SSO:
curl -v -H "Authorization: token TOKEN" -X POST ...
Those token have just seen a new format update (Apr. 2021) so you might need to regenerate one.

How to perform curl command to Secured ElasticSearch (ElasticSearch running in Openshift namespace openshift-logging)

I have installed ElasticSearch in openshift-logging namespace in my openshift cluster.
I'm able to perform curl to elasticsearch using bearer token, now I want to perform curl to ElasticSearch using TLS certs.
CURL working with oc exec
oc exec elasticsearch-cdm -- curl -tlsv1.2 --insecure -H "Authorization: Bearer $(token)" "https://172.30.245.25:9200/_cat/health"
CURL working with elasticsearch service route using bearer token
curl -tlsv1.2 --cacert -H "Authorization: Bearer $(token)" https://$(esRoutes)/_cat/health
Now I want to perform curl using TLS certification, I have extracted secrets from running elasticsearch cluster and included the cert and key filename below,
Certs and Keys:
admin-ca admin-cert admin-key elasticsearch.crt elasticsearch.key logging-es.crt logging-es.key
How to perform CURL to running ElasticSearch (in openshift namespace opernshift-logging) using certs ?.
Hopefully this is what you are looking for:
oc exec -n openshift-logging logging-es-data-master-xxxxx-x-xxxxx -- curl -tls1.2 -s -k --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key https://localhost:9200/_cat/health
optional
oc exec -n openshift-logging logging-es-data-master-xxxxx-x-xxxxx -- curl -tls1.2 -s -k --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key https://localhost:9200/_cat/thread_pool?v
es-util version
oc exec -n openshift-logging logging-es-data-master-xxxxx-x-xxxxx -c elasticsearch -- es_util --query=_cluster/health?pretty=true

Jira API GET all users from Jira project with specific status

In my Ruby app I'm trying to get all agent users from my service desk board. It means all users with status: 'ServiceDesk'. Is it possible using only base auth?
In curl I was trying something like:
curl -D -u USERNAME:PASSWORD -X GET -H "Content-Type: application/json" https://company_name.atlassian.net/rest/api/2/user/assignable/search?project=SERVICEDESK
But all what I get is an error:
Warning: The file name argument '-u' looks like a flag.
curl: (3) URL using bad/illegal format or missing URL
{"errorMessages":["Internal server error"],"errors":{}}%
Is there any way to get those data with basic auth?
I think there's an issue with the curl command, try this
curl -D- -u USERNAME:PASSWORD https://company_name.atlassian.net/rest/api/2/user/assignable/search?project=SERVICEDESK

Curl command on windows not passing user:pass correctly

I'm using CURL to execute some API calls against a bitbucket server. The command is like this:
curl https://bitbucket.myserver.com/rest/api/1.0/projects/PRJ/repos/repo-slug/tags \
-u 'user:pass' \
-X POST \
-H 'Content-type: application/json' \
-d '{"name" : "test-tag", "message": "Test tag from curl", "startPoint": "master" }'
This is expected to create a tag on the master branch in the repo. This however fails complaining of incorrect username/password.
I then copy/paste the command into git-bash prompt - and it works as expected, completing successfully. I tried this with multiple user accounts. I also tried specifying only the username and then entering the password on command line - with the same results.
How can I get curl on windows to pass correct username/password to the server?

Resources