I found this to be very confusing and inconsistent especially when wanting to pass parameters in the body. The following is what I found to be the best approach for building with parameters (passing some parameters and using the specified defaults).
curl -X POST -u "user:pass" \
http://myjenkinsserver/jenkins/job/testjob/buildWithParameters \
-F PARAMETER=somenumber
I also tried the following approaches and mentioning them because they appear in various documentation but don't appear to work correctly/as described.
The below submits a build (build vs buildWithParameters URL) and passes parameters BUT does not use any other default parameters.
curl -X POST -u "user:pass" \
http://myjenkinsserver/jenkins/job/testjob/build \
--data-urlencode json='{"parameter": [{"name":"PARAMETER", "value":"somenumber"}]}'
The below seems like it should work but I found that the parameter was not passed correctly.
curl -X POST -u "user:pass" \
http://myjenkinsserver/jenkins/job/testjob/build \
--data-urlencode json='{"parameter": [{"name":"PARAMETER", "value":"somenumber"}]}'