Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-36203] Added requestBody field to Pipeline Step #15

Merged
merged 1 commit into from
Jun 24, 2016

Conversation

issc29
Copy link
Contributor

@issc29 issc29 commented Jun 23, 2016

@janario
Copy link
Member

janario commented Jun 24, 2016

Merged, Thanks.

I'm going to release it soon

@janario janario merged commit 4f5a0b5 into jenkinsci:master Jun 24, 2016
@crislacumba
Copy link

Hi,

I just saw that it is possible to call the httprequest from the Pipeline.
def response = httpRequest "http://httpbin.org/response-headers?param1=${param1}"
println('Status: '+response.status)
println('Response: '+response.content)

However, if I want to make a POST request with data in the body how can I do that?

Thanks!

Cris

@janisliepins
Copy link

Hi,

I just saw that it is possible to call the httprequest from the Pipeline.
def response = httpRequest "http://httpbin.org/response-headers?param1=${param1}"
println('Status: '+response.status)
println('Response: '+response.content)

However, if I want to make a POST request with data in the body how can I do that?

Thanks!

Cris

How can this be done?

@rupreck
Copy link

rupreck commented Feb 4, 2019

@janisliepins Did you manage to figure this out?

Having the same problem..

@Sebas7ien
Copy link

@janisliepins

Having the same problem, how could I POST Multipart in JenkinsFile using Pipeline?

@jmdingess
Copy link

@janisliepins @rupreck @Sebas7ien
This worked for me:
def response = httpRequest url: 'http://example.com/', authentication: 'credentialID', httpMode: 'POST', requestBody: 'data'
As detailed here

@leonvzGit
Copy link

I am trying to post a jsonObject as data , getting errors the body must be string , but if I create a json string I get the error :
an exception which occurred:
in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals
in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@70809620
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@201d984b
in field com.cloudbees.groovy.cps.impl.CallEnv.caller
in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@4d76511c
in field com.cloudbees.groovy.cps.Continuable.e
in object org.jenkinsci.plugins.workflow.cps.SandboxContinuable@3c902f6d
in field org.jenkinsci.plugins.workflow.cps.CpsThread.program
in object org.jenkinsci.plugins.workflow.cps.CpsThread@f0b36ad
in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads
in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@6dc038ba
in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@6dc038ba
Caused: java.io.NotSerializableException: groovy.json.internal.LazyMap

Here is the json payload string '{"tags": ["sometag"]}'

@veeradatla
Copy link

@leonvzGit have you managed to resolve the issue with post request you were having ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants