curl-users
Re: curl post
Date: Thu, 20 Nov 2014 22:00:55 +0100
On Thu, Nov 20, 2014 at 03:36:11PM +0100, Ingimar wrote:
> I am trying to post an array-list to a restful-service which I created.
> I am able doing this by using JSON, my method is annotated : @Consumes
> (MediaType.APPLICATION_JSON)
>
> as in:
> curl -i -X POST -H 'Content-Type: application/json' -d '{"list":
> ["key1:val1","key2:val2"]}' http://localhost:8080/MediaServerResteasy/media/
> testing
The -X option is redundant here since -d (and -F) already do a POST.
>
> I would like to be able to post from a HTML-FORM.
> I changes the annotation on my restful to :
> @Consumes(MediaType.MULTIPART_FORM_DATA)
>
> Check out the following:
> http://curl.haxx.se/docs/httpscripting.html#POST
>
> did try the following :
> curl -X POST -H "Content-Type:multipart/form-data" -F 'taglist[]=key1:value1'
> -F 'taglist[]=key2:value2' http://localhost:8080/MediaServerResteasy/media/
> testing
>
> curl -X POST -H "Content-Type:multipart/form-data" -F 'taglist=key1:value1' -F
> 'taglist=key2:value2' http://localhost:8080/MediaServerResteasy/media/testing
>
> but neither is working.
How isn't it working? It sends stuff when I try it.
> What am I doing wrong here ?
What do you want curl to send? It sounds like you may be having trouble with
the server end rather than the client end.
>
> My Java-form looks like this:
> @FormParam("taglist")
> private List<String> taglist;
>
> public List<String> getTaglist() {
> return taglist;
> }
>
>
> public void setTaglist(List<String> taglist) {
> this.taglist = taglist;
> }
-------------------------------------------------------------------
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 2014-11-20