Synology chat incoming webhooks - bash

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"}'

Related

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.

Bitcoin how to create a new account via RPC

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

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

Rasa nlu server problem with the error 500 and parsing

I started the nlu server by typing this command in cmd:
rasa run --enable-api -m models/(name of my package).tar
and then in other cmd window typed:
curl localhost:5005/model/parse -d ‘{“text”:“hello”}’
after that I got an error:
{“version”:“1.2.3”,“status”:“failure”,“message”:“An unexpected error
occurred. Error: Failed when parsing body as
json”,“reason”:“ParsingError”,“details”:{},“help”:null,“code”:500}
What is the reason for it? what should I change to get the normal(200) output?
can you please try this and see whether it works.
rasa run -m models --enable-api --cors ‘*’ --debug
CURL POST Request (Mac and Ubuntu):
curl -H "Content-Type: application/json" -X POST -d '{"sender":"y1mLd","message":"hi"}' http://localhost:5005/webhooks/rest/webhook
Note : for windows you need to remove the quotes
curl -H "Content-Type: application/json" -X POST -d {"sender":"y1mLd","message":"hi"} http://localhost:5005/webhooks/rest/webhook
Output
[{"recipient_id":"y1mLd","text":"Welcome, Please let me know how I could be a help today!"}]

How to get H2O automl working from command line using CURL?

I am trying to launch H2O AutoML from command line with CURL and could not get it working..
The base command is something as below:
curl -X POST -H 'application/x-www-form-urlencoded; charset=UTF-8' -d 'training_frame=12cfbae9-af66-42fd-835f-13ccc5a508ab' "http://localhost:54321/99/AutoMLBuilder"
I tried with various parameters with but I always get error as unknown parameter.
I had the use the CURL command as below to make it work:
curl -X POST -H 'Content-Type: application/json' -d '{"input_spec":{"training_frame":"1acfbae9-af66-42fd-835f-13ccc5a508cb","response_column":"mpg","ignored_columns":[],"sort_metric":null},"build_models":{"exclude_algos":[]},"build_control":{"nfolds":5,"keep_cross_validation_predictions":true,"keep_cross_validation_models":true,"balance_classes":false,"class_sampling_factors":[],"max_after_balance_size":5,"stopping_criteria":{"seed":-1,"max_models":0,"max_runtime_secs":30,"stopping_rounds":3,"stopping_tolerance":-1},"project_name":"automl-mpg"}}' http://localhost:54321/99/AutoMLBuilder
Above 1acfbae9-af66-42fd-835f-13ccc5a508cb is the training frame id.

Resources