How I can list all added apps in javamelody monitoring using curl command? - java-melody

curl -vkg http://collectserver/ -H 'Authorization: Basic abc123==' -d "appName=APP_NAME&appUrls=http://myhost/myapp/"
This is working curl to add apps in javamelody monitoring
And I also tested for delete application
curl -v
"http://collectserver/collectServer?action=remove_application&application=$APP_NAME" -H 'Authorization: Basic abdvcgvh'
Now I want to create curl to list all added application using curl command plz help

You can call the same URL with the parameters "?part=applications&format=json" or "?part=applications&format=xml"
You will get a map in json, which lists the applications as keys.
For example, curl -v "http://collectserver/collectServer?part=applications&format=json" -H 'Authorization: Basic abdvcgvh'

Related

How to POST two files

I am trying to post two different files using the command
curl -vX POST http://localhost/api/postJSON -d #input.json -d #input2.json --header "Content-Type: application/json"
I know something is wrong. Does anyone have any idea about this?
Consulting the curl manpage and identify the -F option (https://curl.haxx.se/docs/manpage.html#-F).
There's also an example of uploading multiple files via curl at https://medium.com/#petehouston/upload-files-with-curl-93064dcccc76#e822
$ curl -F 'fileX=#/path/to/fileX' -F 'fileY=#/path/to/fileY' ... http://localhost/api/postJSON upload

OpenShift/Origin API call to initiate a deployment

Hi :) I'm trying to mimic the oc cli API call to the master node that initiates a deployment. So eventually, I can have a chatbot that can initiate a deployment without needing to install the oc cli.
What is the API call to initiate a deployment?
When I look at what the oc cli is doing with oc deploy <app> --latest --loglevel=9. I see it fetching information only:
curl -k -v -XGET -H "Authorization: Bearer <token>" -H "User-Agent: oc/v1.3.0 (darwin/amd64) openshift/d451518" -H "Accept: application/json, */*" https://<host>:<port>/oapi/v1/namespaces/<namespace>/deploymentconfigs/<app>
curl -k -v -XGET -H "User-Agent: oc/v1.3.0+52492b4 (darwin/amd64) kubernetes/52492b4" -H "Authorization: Bearer <token>" -H "Accept: application/json, */*" https://<host>:<port>/api/v1/namespaces/<namespace>/replicationcontrollers/<app>-15
Where does it make the call to initiate the deployment? And how do I mimic it?
I wasn't able to find anything in these docs:
https://docs.openshift.org/latest/rest_api/openshift_v1.html
https://docs.openshift.org/latest/rest_api/kubernetes_v1.html
Thank you for your time!
Not sure if this is where you are wanting to go but your maybe looking for this
create instantiate of a DeploymentRequest
POST /oapi/v1/namespaces/{namespace}/deploymentconfigs/{name}/instantiate
https://docs.openshift.org/latest/rest_api/openshift_v1.html#create-instantiate-of-a-deploymentrequest
https://docs.openshift.org/latest/rest_api/openshift_v1.html#v1-deploymentrequest

Publish to Chrome Webstore using the items.Publish API and cURL

We are developing a Chrome Extension and, as part of the release build, we want to publish it to the Chrome Webstore for testing.
We are using cURL to send the http requests.
Using the information in :
https://developer.chrome.com/webstore/using_webstore_api
we have successfully updated the store, but I am seeing an odd error when trying to publish it using the information in
"Publishing an item to trusted testers" in the above link.
The command line looks like this as suggested in the link above:
curl -H "Authorization: Bearer %refresh_token%" -H "x-goog-api-version: 2" -H "Content-Length: 0" -H "publishTarget: trustedTesters" -X POST -v https://www.googleapis.com/chromewebstore/v1.1/items/%app_id%/publish
When I run this I get an error back stating that the publish condition is not met. The error message states that we should set publish_to_trusted_testers=true, but I can find no documentation suggesting how or where I should set this.
Note that access tokens are working OK, and the PUT command to upload the new extension is also successful.
Any advice would be gratefully accepted.
Jon
https://developer.chrome.com/webstore/webstore_api/items/publish#parameters
The docs on https://developer.chrome.com/webstore/using_webstore_api don't currently point to the correct use of the api, but the publish docs are correct.
I tried url query and it succeeded:
curl \
enter code here-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "x-goog-api-version: 2" \
-H "Content-Length: 0" \
-X POST \
-v \
https://www.googleapis.com/chromewebstore/v1.1/items/$APP_ID/publish?publishTarget=trustedTesters

Curl to Advanced rest Client

i need to send below curl command using rest client
curl -X POST -H "Content-Type: application/json"
\ -H "Authorization: Basic MzUzYjMwMmM0NDU3NGY1NjUwNDU2ODdlNTM0ZTdkNmE6Mjg2OTI0Njk3ZTYxNWE2NzJhNjQ2YTQ5MzU0NTY0NmM="
\ -d '{"user":{"emailAddress":"test#example.com"}, "password":"password"}'
\ 'http://localhost:8080/oauth2-provider/v1.0/users'
so far i have managed to put it like above screen but im not sure how to
put
-d '{"user":{"emailAddress":"test#example.com"}, "password":"password"}'
in rest client
there is a section below for "payload"
that is where the json that you have should be placed.
the "-H" content is for the header
the "-d" is for the contents (body)
and for what its worth, the industry standard has been moving towards postman as a common chrome plugin/tool instead of advanced rest client, but to each their own.

Create new gist with Github API v3 using curl

After fighting for quite some time for posting a private gist to Github using their API V3 I almost gave up. Almost. May be some one have also faced similar problem or know what might be the reasoning of the following behavior:
Right now the curl command looks like following:
curl -H "Authorization: bearer MY_AUTHORIZATION_TOKE" -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"public":false,"files":{"test.txt":{"content":"String file contents"}}}' https://api.github.com/gists
I also tried
curl -H "Authorization: bearer MY_AUTHORIZATION_TOKE" -X POST -d '{"public":false,"files":{"test.txt":{"content":"String file contents"}}}' https://api.github.com/gists
I am able to create gist without authorization token using exactly same data:
curl -X POST -d '{"public":true,"files":{"test.txt":{"content":"String file contents"}}}' https://api.github.com/gists
But in that case it will be anonymous
Same results if I am truing to post it as public
In any case Github returns me
HTTP/1.1 404 Not Found
{
"message": "Not Found"
}
I am pretty sure I am authorized, as curl -H "Authorization: bearer MY_AUTHORIZATION_TOKE" https://api.github.com/user returns me my user details.
Application scope is as:
https://github.com/login/oauth/authorize?client_id=...&scope=gist
So, it should have both read and write permission.
Your OAuth2 token doesn't appear to have the required gist scope.
If you run the curl commands with the -v argument you can see the scope sent to request (X-OAuth-Scopes header) and the scope required for the request (X-Accepted-OAuth-Scopes header) to successfully be performed using the token sent.
If you don't see gist listed in the X-OAuth-Scopes header value then that is your problem.