cURL / Mailing Lists / curl-users / Single Mail

curl-users

posting a JSON-list, syntax ?

From: Ingimar <inkimar_at_gmail.com>
Date: Mon, 13 Apr 2015 21:46:48 +0000

Hello,

I am posting a json to a java-backen. I am using Wildfly version 8.2
This works fine.
My method is decorated with the following annotation :

@Consumes(MediaType.APPLICATION_JSON)

@Produces(MediaType.APPLICATION_JSON)

Now I would like to replace a String with a List of Strings.
Having problem with the syntax

My example looks like this right now :

curl -v -H "Accept: application/json" -H "Content-type: application/json"
> -X POST -d '{"owner":"malcolm","access":"public","licenseType":"CC
> BY","legend":"this is
> peter","fileName":"tosh.jpg","tags":"view=left&music=reggea"}'
> http://127.0.0.1:8080/service/media

I want to change "tags":"view=left&music=reggea" to the below ( the idea
is "key":"value" )

And do the below ( inspiration from
https://jersey.java.net/documentation/1.18/json.html )
I do not reach wildfly, the log is quiet

curl -v -H "Accept: application/json" -H "Content-type: application/json"
> -X POST -d '{"owner":"malcolm","access":"public","licenseType":"CC
> BY","legend":"this is peter","fileName":"tosh.jpg",*"tags":[{"view":"left","music":"reggea"}]
> *}' http://127.0.0.1:8080/service/media

I do not get in touch with my service , this is the reply

* Hostname was NOT found in DNS cache

* Trying 127.0.0.1...

* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)

> POST /service/media HTTP/1.1

> User-Agent: curl/7.35.0

> Host: 127.0.0.1:8080

> Accept: application/json

> Content-type: application/json

> Content-Length: 149

>

* upload completely sent off: 149 out of 149 bytes

< HTTP/1.1 400 Bad Request

< Connection: keep-alive

< X-Powered-By: Undertow/1

* Server WildFly/8 is not blacklisted

< Server: WildFly/8

< Content-Type: application/json

< Content-Length: 0

< Date: Mon, 13 Apr 2015 23:39:07 GMT

<

* Connection #0 to host 127.0.0.1 left intact

any ideas ?

Regardds, i

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-04-13