cURL / Mailing Lists / curl-users / Single Mail

curl-users

curl post

From: Ingimar <inkimar_at_gmail.com>
Date: Thu, 20 Nov 2014 15:36:11 +0100

Hi!

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

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.
What am I doing wrong here ?

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;
    }

Regards, 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 2014-11-20