0

i am very new to the java EE.

I have built some simple restful client for calling rest api's from java using jersey framework.

I have one curl request which i have to call from java

curl -i -X POST 'https://{url}' -H 'Content-Type: application/x-www-form-urlencoded' -H "Accept: application/vnd.newbay.dv-1.8+json" -H "X-HTTP-METHOD-OVERRIDE: DELETE" -H "X-Client-Platform: SERVICES" -H "X-Client-Identifier: IL" --insecure --data 'path=%2FMy+Samsung+GT-I9082%2F20130822_172409.jpg&path=%2FMy+Samsung+GT-I9082%2F20130905_085407.jpg'

Here the paths of file are passed as form post in curl using --data.

Can anyone tell me how to call this api from my java program using jersey framework? I am having difficulty because of this --data part? how exactly i will pass that in my restful java client that i cant understand.

Also can anyone tell me how to pass form post --data part while calling the same api from soapUI?

mihir S
  • 617
  • 3
  • 8
  • 23

1 Answers1

0

In your cURL command, --data provides post data in a classic html form format. You shoud alrealy be aware of that because the content-type is explicit : application/x-www-form-urlencoded

Jersey can handle this encoding for you, using MultivaluedMapImpl.

see Sending Name Value Pair in POST using Jersey Client

Community
  • 1
  • 1
Stephane Lallemagne
  • 1,246
  • 11
  • 21