I want to remotely trigger a Job that triggers POST request to an API.
I need all data (body, url, auth, etc) through input jenkins request.
Is this possible? I found this link but this doesn't seem to work.
I tried the following URLs to trigger my job : curl --request POST --header 'Authorization: Basic (auth)' --data-urlencode json='{"parameter": [{"name":"REQUEST_URL", "value":(url)},{"name":"REQUEST_BODY", "value":(json as string)}]}' (jenkinsUrl)/buildWithParameters?delay=0sec&token=(token)
response : --data-urlencode: command not found
curl --request POST --header 'Authorization: Basic (auth)' --data json='{"parameter": [{"name":"REQUEST_URL", "value":(url)},{"name":"REQUEST_BODY", "value":(json as string)}]}' (jenkinsUrl)/buildWithParameters?delay=0sec&token=(token)
response : nothing, job not triggered.
Note that the job gets triggered properly if I add all the params in the URL. My issue is that most of the request body will be too large to fit in request params.
This has beed resolved.
I used the following API call:
curl --request POST (jenkinsUrl)/buildWithParameters?delay=0sec&token=(token) --header 'Authorization: Basic (auth)' --data 'REQUEST_URL=(url)' --data 'REQUEST_BODY=(utf-8 encoded json as string)'
REQUEST_URL
and REQUEST_BODY
are parameters set in Jenkins Job that I'm building.