View individual deployment status in Wildfly with curl/API - jboss

I'm very new to Wildfly but I need to set up automated monitoring of individual deployment status via the API.
In the same way that I can view the server state with curl, eg:
curl --insecure --digest 'https://admin:password#localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute","name":"server-state","json.pretty":1}'
Will return:
{
"outcome" => "success",
"result" => "running"
}
In the same way the from the jboss-cli, I issue:
:read-attribute(name=server-state)
And get the same result.
So, from the CLI, if I issue the following command to get the status of a specific deployment:
/deployment=bob :read-attribute(name=status)
I get the following result:
{
"outcome" => "success",
"result" => "OK"
}
But I can't work out what curl command will give me that result. I've read through a tonne of documentation and either it doesn't exist or I'm looking in the wrong spot. I've tried:
curl --insecure --digest 'https://password#localhost:9993/management' --header "Content-Type: application/json" -d '{"deployment":"bob","operation":"read-attribute","name":"status","json.pretty":1}'
but that didn't work. Any ideas?
Thanks,
Mark J.

You need to add an array for the address attribute and move the "deployment":"bob" in the array.
curl --insecure --digest 'https://password#localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute", "address":[{"deployment":"bob"}],"name":"status","json.pretty":1}'
The address is a name/value pair object for the path the attribute you want to read. For example if you wanted to see the all the handlers associated with the root logger you could execute the following.
curl --insecure --digest 'https://password#localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute","address":[{"subsystem":"logging"},{"root-logger":"ROOT"}],"name":"handlers","json.pretty":1}

Related

Where do I find the paths value to use with the Xray REST API - Artifact Summary call?

The XRay Rest API Artifact Summary "provides details about any artifact specified by path identifiers or checksum." The documentation ( https://www.jfrog.com/confluence/display/JFROG/Xray+REST+API#XrayRESTAPI-ArtifactSummary ) offers this template:
{
"checksums": [
""
],
"paths": [
""
]
}
This works if I use the SHA256 checksum of the artifact I'm interested in, however I can't determine the syntax to use with the paths tag.
From our Artifactory UI, the artifact ( a docker image's manifest.json file) has this repository Path: REPO_NAME/os/ubuntu20/ubuntu20/20.04.5/manifest.json
Using the SHA256 value for the manifest.json file in the call correctly returns the Artifact Summary json:
curl -ufoo:bar -H "Content-Type: application/json" -d '{"checksums" : ["<SHA256_Artifact_1>"]}' -X POST https://localhost/xray/api/v1/summary/artifact
Unforutnately, using any combination of values in the 'paths' field returns a not indexed/cached in Xray.
API calls:
curl -ufoo:bar -H "Content-Type: application/json" -d '{"paths" : ["REPO_NAME/os/ubuntu20/ubuntu20/20.04.5/manifest.json"]}' -X POST https://localhost/xray/api/v1/summary/artifact
curl -ufoo:bar -H "Content-Type: application/json" -d '{"paths" : ["os/ubuntu20/ubuntu20/20.04.5/manifest.json"]}' -X POST https://localhost/xray/api/v1/summary/artifact
curl -ufoo:bar -H "Content-Type: application/json" -d '{"paths" : ["os/ubuntu20/ubuntu20/20.04.5/manifest.json"], "repo" : "REPO_NAME"}' -X POST https://localhost/xray/api/v1/summary/artifact
curl -ufoo:bar -H "Content-Type: application/json" -d '{"paths" : ["os/ubuntu20/ubuntu20/20.04.5/manifest.json"]}' -X POST https://localhost/xray/api/v1/summary/artifact?repo=REPO_NAME
Returns string:
{"artifacts":[],"errors":[{"identifier":"REPO_NAME/os/ubuntu20/ubuntu20/20.04.5/manifest.json","error":"Artifact doesn't exist or not indexed/cached in Xray"}]}
I'm looking to use the Artifact path (which is known) to request the Artifactory Summary JSON. Any suggestions on how this is to be formatted?

ADO Linking requirement & test case work items with Rest API issue

I'm trying to link a ADO Requirement work item to a ADO Test Case work item. I'm making this call:
curl -u :********** -X PATCH -H "Content-Type: application/json-patch+json" -H "Accept: application/json-patch+json" -d "[{{\"op\": \"test\", \"path\": \"/rev\",\"value\": 3 },{\"op\": \"add\", \"path\": \"/relations/-\", \"value\":\"{\"rel\": \"System.LinkTypes.Dependency-forward\",\"url\": \"https://***.***.com/{Organisation}/_apis/wit/workItems/{ID}\",\"attributes\": {\"comment\": \"Making a new link for the dependency\"}}}}]" https://***.***.com/{Organisation}/{Project}/_apis/wit/workItems/{ID}?api-version=6.0
as per: https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/update?view=azure-devops-rest-7.1#add-a-link
But I'm having this error:
{"$id":"1","innerException":null,"message":"You must pass a valid patch document in the body of the request.","typeName":"Microsoft.VisualStudio.Services.Common.VssPropertyValidationException, Microsoft.VisualStudio.Services.Common","typeKey":"VssPropertyValidationException","errorCode":0,"eventId":3000}
I found my answer, the JSON was badly parse. I used a online JSON linter to fix it. https://jsonlint.com/
curl -u :********** -X PATCH -H "Content-Type: application/json-patch+json" -H "Accept: application/json-patch+json" -d "[{\"op\": \"add\", \"path\": \"/relations/-\", \"value\":{\"rel\": \"Microsoft.VSTS.Common.TestedBy-Forward\",\"url\": \"https://***.***.com/{Organisation}/_apis/wit/workItems/{ID}\",\"attributes\": {\"comment\": \"Making a new link for the dependency\"}}}]" https://***.***.com/{Organisation}/{Project}/_apis/wit/workItems/{ID}?api-version=6.0

kraken cURL REST API cannot send order saying invalid arguments

I am able to call private user API through code like this:
curl -X POST -H "Accept: application/json" -H "API-Key: mykey" -H "API-Sign: mysign" -d "nonce=123" https://api.kraken.com/0/private/Balance
feedback is telling me how much USD and ETH i have left in my account.
but when I switch to this trying to send order:
curl -X POST -H "Accept: application/json" -H "API-Key: mykey" -H "API-Sign: mysign" -d "nonce=123" 'https://api.kraken.com/0/private/AddOrder?pair=XXBTZUSD&type=buy&ordertype=market&volume=0.01'
it says {"error":["EGeneral:Invalid arguments"]}, how can i fix it?
It seems you need to set the Content-Type header to whatever it is. In this case application/x-www-form-urlencoded. Bit odd that it's not in the docs.

list servers OrientDB 2.2. via http rest

i try to get servers status of distributed version of OrientDB via http rest :
curl --user admin:admin --header "Accept: text/csv" -d "list servers " "http://localhost:2480/command/GratefulDeadConcerts/sql"
doesnt works :
{
"errors": [
{
"code": 500,
"reason": 500,
"content": "com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.list servers\u000d\u000a\u0009DB name=\"GratefulDeadConcerts\""
}
you're sending a list servers command to the sql interpreter while that's not a sql command but a console one.
UPDATE
you can use this
curl --user root:root --header "Accept: text/csv" -d "HA STATUS -servers -output=text" "http://localhost:2480/command/GratefulDeadConcerts/sql"
Run this command to get the results as JSON that contains all servers (nodes) with detailed status and info per server:
curl -X POST --user {{user}}:{{password}} --header "Accept: application/json" \
-d "HA STATUS -servers -db" "{{orientdb-url}}:2480/command/{{database-name}}/sql"

How to use Curl to invoke a Temboo API?

How can I use curl to invoke a Temboo API? I want to get a list of all Temboo APIs.
Below is the Curl example given on a Temboo Rest API webpage. I'm not sure how to change it for correct access.
curl -k --basic -u user#temboo.com:test1234 --header "Accept: application/xml" --header "Content-Type: application/xml" --header "x-temboo-domain: /myOrg/master" https://myOrg.temboolive.com:443/temboo-api/1.0/choreos
Changes:
Change user#temboo.com:test1234 to the email address and password on file at Temboo. e.g. toto#totomail.com:totopassword
Change all instances of myOrg to your Temboo account name. e.g. toto.
curl -k --basic -u toto#totomail.com:totopassword --header "Accept: application/xml" --header "Content-Type: application/xml" --header "x-temboo-domain: /toto/master" https://toto.temboolive.com:443/temboo-api/1.0/choreos