Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #34755 > unrolled thread

How to send 'Payload' in POST to REST API ?

Started bymike <mikaelpetterson@hotmail.com>
First post2016-07-04 01:30 -0700
Last post2016-07-04 01:30 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.programmer


Contents

  How to send 'Payload' in POST to REST API ? mike <mikaelpetterson@hotmail.com> - 2016-07-04 01:30 -0700

#34755 — How to send 'Payload' in POST to REST API ?

Frommike <mikaelpetterson@hotmail.com>
Date2016-07-04 01:30 -0700
SubjectHow to send 'Payload' in POST to REST API ?
Message-ID<8f052e5e-e8ee-4059-b850-ce8c7ad9b795@googlegroups.com>
Hi,

I tried:

 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-changes-plugin</artifactId>
 <version>2.12</version>

and use it together with JIRA REST API.

The plugin sent in the following information, see below.

Since the error message does not seem correct I wonder if it is possible:

1. Use a free tool ( firefox plugin/std alone client) as sender. 
2. How do I add the content of payload data into the message sent by tool?


br,

//mike


ID: 4
Address: https://plf-jira.rnd.ki.sw.company.se/rest/api/2/search
Http-Method: POST
Content-Type: application/json
Headers: {Accept=[application/json], Content-Type=[application/json], Cookie=[$Version="1"; atlassian.xsrf.token=AH4X-O4PW-W5OL-3W41|af4e0219581d406a19e87a6057dae15c67473c5b|lout; $Path=/]}
Payload: {"jql":"project = BRR AND status in (6) AND resolution in (10100) ORDER BY priority DESC, created DESC","maxResults":100,"fields":["*all"]}
--------------------------------------
[DEBUG] Response Code: 400 Conduit: {https://plf-jira.rnd.ki.sw.company.se}WebClient.http-conduit
[DEBUG] Content length: -1
[DEBUG] Header fields: 
    null: [HTTP/1.1 400 Bad Request]
    Transfer-Encoding: [chunked]
    Date: [Mon, 04 Jul 2016 07:44:21 GMT]
    Via: [1.1 plf-jira.rnd.ki.sw.company.se]
    Connection: [close]
    Content-Type: [application/json;charset=UTF-8]
    X-AUSERNAME: [anonymous]
    X-AREQUESTID: [584x1654899x1]
    Server: [Apache-Coyote/1.1]
    X-Content-Type-Options: [nosniff]
    Cache-Control: [no-cache, no-store, no-transform]

[DEBUG] Adding interceptor org.apache.cxf.interceptor.LoggingInInterceptor@377f6927 to phase receive
[DEBUG] Chain org.apache.cxf.phase.PhaseInterceptorChain@6a81e18e was created. Current flow:
  receive [LoggingInInterceptor]

[DEBUG] Invoking handleMessage on interceptor org.apache.cxf.interceptor.LoggingInInterceptor@377f6927
[INFO] Inbound Message
----------------------------
ID: 4
Response-Code: 400
Encoding: UTF-8
Content-Type: application/json;charset=UTF-8
Headers: {Cache-Control=[no-cache, no-store, no-transform], connection=[close], content-type=[application/json;charset=UTF-8], Date=[Mon, 04 Jul 2016 07:44:21 GMT], Server=[Apache-Coyote/1.1], transfer-encoding=[chunked], Via=[1.1 plf-jira.rnd.ki.sw.company.se], X-AREQUESTID=[584x1654899x1], X-AUSERNAME=[anonymous], X-Content-Type-Options=[nosniff]}
Payload: {"errorMessages":["The value 'BRR' does not exist for the field 'project'."],"errors":{}}
--------------------------------------
[ERROR] The value 'BRR' does not exist for the field 'project'.
[WARNING] 
org.apache.maven.plugin.MojoExecutionException: Failed to query issues; response 400
	at org.apache.maven.plugin.jira.RestJiraDownloader.reportErrors(RestJiraDownloader.java:211)
	at org.apache.maven.plugin.jira.RestJiraDownloader.doExecute(RestJiraDownloader.java:165)
	at org.apache.maven.plugin.jira.AdaptiveJiraDownloader.doExecute(AdaptiveJiraDownloader.java:45)
	at org.apache.maven.plugin.jira.JiraMojo.executeReport(JiraMojo.java:341)
	at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:255)
	at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:210)
	at org.apache.maven.plugin.changes.AbstractChangesReport.execute(AbstractChangesReport.java:203)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)


[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web