curl command error - URL using bad/illegal format - docker

when i run this command :
curl --user "api:$MAILGUN_API_KEY"
"https://api.mailgun.net/v3/$MAILGUN_DOMAIN/messages"
i am getting attached error , the api key and domain i have verified .Can you please help?

Related

Jenkins "Error 403 No valid crumb was included in the request"

I am trying to trigger a Jenkins build by post request from my Windows computer, using the following commands.
First, I obtain the crumb using...
curl http://JENKINS-URL/crumbIssuer/api/xml?xpath=//crumb
The response is this...
<crumb>string-of-digits<\crumb>
I then use the command
curl -u USERNAME:PASSWORD -X POST -H "Jenkins-Crumb:string-of-digits" http://JENKINS-URL/job/my-job/buildWithParameters?token=my-token
The username is correct, the password is correct, the crumb is exactly the string of digits that I got from the first command (everything between the crumb> at the beginning and <\crumb> at the end), the token matches the token I have specified in Jenkins. But still, I am getting the response
Error 403 No valid crumb was included in the request
In Configure Global Security -> CSRF Protection, I also have "Enable proxy compatibility" checked and am using "Default Crumb Issuer".
Does it look like I am missing anything here? Forgetting any steps? Improperly formatted commands? Anything else you might be able to think of?
I have followed the steps and formatted my command like the solution here as well, and still no luck..
https://linuxacademy.com/community/posts/show/topic/28964-no-valid-crumb-was-included-in-the-request
In addition to this, I have also tried saving the cookies from the first request to get the crumb, and then I pass the file I saved the cookies to into the second curl command, see below for the command. Still I am getting the 403 No valid crumb...
Here are the commands using cookies...
wget --keep-session-cookies --save-cookies cookies.txt --auth-no-challenge --user admin --password my_password -q --output-document - http://JENKINS-URL/crumbIssuer/api/xml?xpath=//crumb
curl --cookie cookies.txt -u admin:my_password -H "JenkinsCrumb: string-of-digits-from-stdout" -X POST http://JENKINS-URL/job/my-job/buildWithParameters?token=my-token
I have finally discovered the answer. I thought that I could specify my actual account password, but it turns out that I needed to use an API token to authenticate. Using the API token instead of my password on the above commands with cookies allowed me to trigger my build remotely.
enter image description here
I finally resolved this issue by selecting the jenkins own user database in security realm

Create repo on Bitbucket programmatically

I used to do
curl -k -X POST --user john#outlook.com:doe13 "https://api.bitbucket.org/1.0/repositories" -d "name=logoApp"
and success.
now I got : error
{"type": "error", "error": {"message": "Resource removed", "detail": "This API is no longer supported.\n\nFor information about its removal, please refer to the deprecation notice at: https://developer.atlassian.com/cloud/bitbucket/deprecation-notice-v1-apis/"}}
Does anyone know a know way to do this ?
There's a difference between a success from curl (OK:200) and an error from the service you're trying to use. The error, however, mentions that you're trying to use the Cloud Rest API version 1, which is deprecated effective 30 June 2018.
Read this for more information.
I don't use Bitbucket Server (a local option), and I think that has more features for this sort of thing.
For the public Bitbucket, you can still do it but it isn't documented.
The v1.0 API has been removed, and the new v2.0 API doesn't document a POST to a /repositories. Instead, you have to hit an endpoint that includes the repo that doesn't yet exist: /repositories/workspace/repo_slug
The JSON payload needs to know the project for the repo: look in the slug for a project that already exists. Fill in the user/team and repo name in the URL. And, you can make an application password so you aren't using your account password. This app password can limit the scope of what that access can do.
% curl -X POST --user 'user:app_pass' \
-H "Content-type: application/json" \
-d '{"project":{"key":"PROJ"}}' \
"https://api.bitbucket.org/2.0/repositories/USER/REPO"

Using REST API to deploy Liberty Docker containers

Has anyone been able to use the WebSphere Liberty REST API to deploy remote Docker containers? The docs describe all the steps, but I am not able to repeat the results. I get an error when calling REST deploy function (details are posted on the other forum).
If anyone was able to do it - please let me know and would be great if you share how you were able to do it.
Not long after posting this question I tried using the curl command with the JSON header spec and now it works. Here is the curl command I am using that works:
curl --verbose --insecure -X POST --data #docker_deploy.json --header "Content-Type: application/json" -u ${ADMIN_USER}:${ADMIN_PASSWORD} https://${CONTROLLER_HOST_NAME}:${CONTROLLER_PORT}/ibm/api/collective/v1/deployment/deploy

405 Error when attempting to trigger remote Jenkins job with wget

I've got a remote Jenkins job which does not require any login to start. This is a parameterized job, so it is normally started with "Build With Parameters".
When trying to trigger this build (with default parameters), I call the following:
wget [url_to_job]/build
And I get this error:
Connecting to 10.57.112.238:8080... connected.
HTTP request sent, awaiting response... 405 Method Not Allowed
2016-03-14 11:49:34 ERROR 405: Method Not Allowed.
From what I have read, I would think that this should work.
Am I doing something wrong?
First, the URL for Remote Trigger should be wget [url_to_job]/buildWithParameters not [url_to_job]/build.
You can pass parameters by using wget [url_to_job]/buildWithParameters/?{parameterName}={parameterValue}
Eg : http://localhost:8080/jenkins/job/test/buildWithParameters/?name=arun
You better use curl instead of wget and also provide credentials for the command:
curl -XPOST --silent --show-error --user <user>:<key> <url_to_job>/build
wget --auth-no-challenge --delete-after --verbose "http://10.157.163.249:8080/job/scanning/buildWithParameters?token=scan&buildURL='abcdefg'"
The problem most likely is that you haven't copied the token over into the "Authentication Token" field of the build trigger. Clicking the checkbox isn't enough - Jenkins will silently remove the checkbox unless a token was provided.
Once I did this the following command worked:
wget --auth-no-challenge --user STRING --password STRING --output-document - 'http://localhost:8080/job/PROJECT/build?token=TOKEN'
Of course it is BAD PRACTICE to put passwords into scripts or the command line history. See this post to learn how to store the credentials in ~/.netrc.

PhantomJS - sending a POST from the cmd w/ Curl isn't working

I'm getting an error when I tried to post the sample codes found in your documentation http://www.highcharts.com/docs/export-module/render-charts-serverside.
Here is the screencast when I tried to start PhantomJS through commandline.
http://www.screencast.com/t/rDcPYZOi1
Here is the error when I tried to post through commandline using curl.
http://www.screencast.com/t/GnYoMBsUqXfR
Here are the other details that might be probably helpful for investigating what is cause of the error.
Files that were all in one location.
http://www.screencast.com/t/VJ7aK6igSTha
I have also tried to run this code through commandline **"phantomjs highcharts-convert.js -infile options.json -outfile chartTest.png -scale 2.5 -width 300 "** and it works and rendered a graph.
http://www.screencast.com/t/G3U2QatAjgU
Just let me know if you need any other details to solve the issue.
Okay, the problem is with extra spaces and using ' in CLI.
Working JSON example for windows CURL:
curl -H "Content-Type: application/json" -X POST -d "{\"infile\":\"{series:[{data:[29.9,71.5,106.4]}]}\"}" 127.0.0.1:8080

Resources