Unable to launch a single user using REST api - rest

I am using JuPyter hub on K8s. I went through the documentation and had a look at the APIs. Now, I want to use one to start a pod. However, I am unable to start one using this post.
What would be the curl request for this POST request?
I have tried with the given command and it does not work:
curl -XPOST http://some_ip.ap-south-1.elb.amazonaws.com/users/adwait/server
405 : Method Not Allowed

Related

How can i get the logs of git using github API

I referred to many documents to get the logs of GitHub using GitHub API. But I couldn't find the way. I want to get the logs of GitHub events(commit, changes, etc..) and send them to cloudwatch. How can I achieve this? Or any other way to get the log without using authentication?
For example, I need a command like this so that I can get the logs without touching GitHub
curl -i -H "Authorization: token <PAT token>." \
https://api.github.com/user/repos
or any program to get the logs is welcome
or Any rest API to get the GitHub logs
I am not familiar with GitHub. can anyone give me a solution or idea?
below I mentioned the links that I have followed. Anyone can refer and if possible modify any command or API call to get the logs it would be great.
https://www.softwaretestinghelp.com/github-rest-api-tutorial/
https://dev.to/gr2m/github-api-authentication-personal-access-tokens-53kd
https://titanwolf.org/Network/Articles/Article?AID=f441bab7-8fc8-45ae-b12b-4c41efbbe2d1

Jenkins API Crumb 403

I am using Curl to make requests to the Jenkins API - which is being done over https.
Jenkins is setup in IIS using a reverse proxy as advised by Jenkins.
The Jenkins site has windows authentication.
I need to pass a Crumb with my request - 403 error.
However, when I request for the Crumb, it states that I need to provide a Crumb?
I need this to work via the command prompt/batch file.
Thanks
To be able to do API calls to Jenkins, you need to generate a token for a given user in Jenkins. For example, let's do it with user Foo. You'll need to sign in with Foo user and then in the web UI: Foo (right upper corner) > Configure > API token > Add new token.
When you have your token saved somewhere, you can retrieve the breadcrumb with this command:
curl --user Foo:<token> 'https://www.mysuperduperjenkins.com/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)'
What this is doing basically is fetching the XML from Jenkins that contains the breadcrumb and getting the specific element where the breadcrumb is. The result of the command should be something similar to:
Jenkins-Crumb:<someLongLongLongToken>
You can save the breadcrumb into a variable, for example name it breadcrumb and then:
curl -u 'Foo:<token>' -X POST --data '<parameters>' -H '$breadcrumb' www.mysuperduperjenkins.com
In this curl we're using the breadcrumb as a header, obtained in previous step. If the crumb is valid you should be able to perform the request without 403/401 errors.

KafkaConnect Rest API Basic Authentication Issue

We are currently using Kafka version 2.11 and KafakConnect 2.0.0 which is part of the hortonworks distribution we have got. We have enabled Rest API basic authentication by adding this in connect.distributed.properties
listeners=https://${hostname}:${restPort}
and following all the steps mentioned here.
Now everything is working and we are able to use basic auth in all GET and POST operations on the leader node while only GET operations are working on the worker nodes. When we try to do POST operation on worker node we get this Error -
{"error_code":500,"message":"IO Error trying to forward REST request: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header"}
As per message its quite evident that the worker is trying to forward the POST/DELETE request to Leader and its failing to do so. A sample DELETE request which is failing is like this:
curl -X DELETE -i -H 'Accept:application/json' -H 'Authorization:Basic base64encodedpassword' https://hostname:18084/connectors/someconnector
Please help if someone has faced this issue before. May be something is wrong in formation of my rest request but it works fine when executed on cluster leader... Thanks

How to successfully pull data from Veracode through REST API?

I'm trying to pull data from veracode(json or xml). I tried to use curl to connect to the api but i keep getting the error:"Failed to connect to analysiscenter.veracode.com port 443:Timed out".
curl --compressed -u USERNAME:PASSWORD https://analysiscenter.veracode.com/api/5.0/getapplist.do -F "include_user_info=true"
According to veracode documentation, to connect to the API, one needs to have Reviewer or Security Lead role.I have both Reviewer and Submitter role.The curl command should return some data like this:
xsi:schemaLocation="https://analysiscenter.veracode.com/schema/2.0/applist https://analysiscenter.veracode.com/resource/2.0/applist.xsd" >applist_version="1.2" account_id="123">Code" policy_updated_date="2013-11-11T14:37:34-05:00"/>
create_application_profile="true" create_sandbox="true" >create_new_build="true" assign_app_to_team="true" >assign_app_to_any_team="true" view_sandbox="true" view_results="true" >approve_mitigations="true" submit_static_scan="true"/>
this looks like a network issue, based on the error that you pasted. Can you ping the URL?
CURL also needs some configuration to use SSL. See this answer for some tips:
Configuring cURL for SSL

Where do I find the REST urls and json structs corresponding to each vmc command?

I am trying to use CloudFOundry REST calls to create app, bind service etc instead of using vmc or eclipse plugin. I know we can use vcap-java-client for this but I also wanted to test calling the REST services directly such as by using cUrl utility. Where do I find the REST urls and json structs corresponding to each vmc command ?
The best way for you to see the actual rest calls to the Cloud Controller is executing the vmc commands and add the -t. So for example:
vmc apps -t
So this vmc command will show you a list of your apps and so what you get out of the additional -t is a more verbose information which shows the Cloud Controller service you are calling. In this case it would be /apps
The same command on the bottom will give you the exact output you would get from the above vmc command:
curl -H "Authorization: <Your-Oauth-token>" https://api.cloudfoundry.com/apps
The Authorization token can also be found in the -t generated output. you need to copy the entire Authorization "bearer"
Sudipta,
When you login and run vmc apps -t, you should see the following output:
Getting applications. >>>
REQUEST: GET /apps
REQUEST_HEADERS:
accept : application/json
user-agent : Ruby
authorization : bearer <token>
content-length : 0
The authorization in REQUEST_HEADERS is what you would need to use.