I am building a Jenkins job via the REST API and need to pass a huge JSON payload to the build - above 2MB
Currently, with less than 2MB JSON payload and using Multi-line input Parameters, I can successfully pass the JSON to the job.
My current usage looks like this
curl -sg -X POST "http://[xxxx:xxxx:xx:xxxx::a]:9090/job/Planner/buildWithParameters" --user admin:xxxxxxcbd73258xxxxxxxxxxx --data INPUT_LINE=$MY_JSON -H 'Accept: application/json'
But anything above 2MB, I get the following error
"error=7, Argument list too long
at java.base"
which corresponds to getconf ARG_MAX -> 2,097,152 on my machine
I am currently looking for a workaround. it seems the ENV variables have a max value which Jenkins is using as build parameters
The solutions given here seems to be also using BuildParameters which wil end up as ENV variables, hence not suitable for setting huge payloads
What is the format of the JSON for a Jenkins REST buildWithParameters to override the default parameters values
Related
trying to fetch list of jobs from Jenkins that has 3 level folder structure, with
myhostname.com.au/jenkins/api/json?tree=jobs[_class,name,buildable]
and getting 400 Bad Request as a response.
None of queries with "tree" work, however others do
i.e.
myhostname.com.au/jenkins/api/json?depth=3&pretty returns all data as expected
same as
myhostname.com.au/jenkins/api/json
couldn't find anything why "tree" wouldn't work.
please advise if you experienced similar,
thansk,
You might need to quote the URL and escape the square brackets as in:
curl -k "http://myhostname.com.au/jenkins/nom/api/json?tree=jobs\[_class,name,buildable\]"
or without the quotes:
curl -k http://myhostname.com.au/jenkins/nom/api/json?tree=jobs\\[_class,name,buildable\\]
If I follow the instructions at this website, the first two (profile.txt and profile.json) should return a .json profile object. Instead I am just getting an output of raw numbers. This was working a few weeks ago so I'm unsure what has changed?
https://console.bluemix.net/docs/services/personality-insights/getting-started.html#getting-started-tutorial
So it turns out for whatever reason, it is returning the raw text values by default, NOT the structured JSON file as specified in the tutorial. An issue has been raised, however in the meantime you can simply add:
--header "Accept: application/json"
This will ensure you get the structured json file.
So I just understood that the Slack Web API does not support JSON data over POST. Which means I have to encode my complex and nested JSON object to fit in query parameters over GET. Problem is, the attachements don't seem to work. Does anyone have a solution ?
So I just understood that the Slack Web API does not support JSON data over POST. Which means I have to encode my complex and nested JSON object to fit in query parameters over GET.
I'm not sure I follow what you mean. You can certainly use POST. The body of a Slack API call should be form-encoded, but parameter values are sometimes JSON (as is the case for attachments).
Here's a working curl command that uses HTTP POST to post a message with a simple attachment.
$ curl -d token=<REDACTED> -d channel=<REDACTED> \
-d text="This is the main text." \
-d attachments='[{"text": "This is an attachment."}]' \
https://slack.com/api/chat.postMessage
I'd recommend using POST, but GET also works fine. If you fill in the values in https://api.slack.com/methods/chat.postMessage/test, the tool will give you a URL at the bottom that you can use with HTTP GET.
I have been using curl & Postman on Chrome to send http POST requests with one variable to an simple HTTP server I have running and I have noticed that they construct the requests slightly differently. Apologies if I might have used any incorrect terminology in constructing the question - I'm still learning this stuff.
Using Postman, the request is constructed by putting a '?' between the resource name and the variable. E.g.
http://192.168.0.2:9999/1/command?a=b
However, the following curl command:
curl -X POST http://192.168.0.2:9999/1/command --data a=b
does not put a '?' between the resource name and the variable.
The result is that the HTTP server interprets the requests differently.
In the first case, the body of the request is empty and in the second case the body contains a=b.
Which version is correct?
Constructing curl , python request , using HTTP POST
Open postman client and click on code [Below save button ] refer snapshot .
when click on code another window appears . refer snapshot .
similarly you can generate various other request [curl , python ,java , php ] refer snapshot
You can refer below link
http://jmeterblogb.blogspot.in/2016/11/constructing-curl-from-python-http-php.html
POST requests post data as part of the request body and GET requests via URL parameters. If you choose the form data option in postman you can pass it the same way (request body) in postman as well. How are parameters sent in an HTTP POST request? may be worth reading.
i have ruby on rails based api which accepts a get request.
example :
http://localhost:3000/api/search?query=whatis&access_token=324nbkjh3g32423
when i do curl from mac terminal like
curl http://localhost:3000/api/search?query=whatis&access_token=324nbkjh3g32423
i checked in the server with "request.fullpath", it return only "/api/search?query=whatis", the second parameter is missing.
however if i do curl like
curl --data="query=whatis&access_token=324nbkjh3g32423" http://localhost:3000/api/search
it is taking all the parameters.
i understand there is a problem with encoding, but i what to know what difference is there with the two requests.
Thanks in advance
The problem probably is that bash shell sees & as the end of the command.
try quoting the entire querystring like this -
curl "http://localhost:3000/api/search?query=whatis&access_token=324nbkjh3g32423"