Using com.sun.jersey.api.client.Client,ClientResponse and WebResource.
Client client = this.client;
WebResource webResource = null;
ClientResponse response = null;
String url = "";
url = "https://test.com/rest/V1/cart/" + quoteId + "/items";
webResource = client.resource(url);
String jsonString = "{\"cartItem\":{\"quote_id\":" + quoteId + ",\"id\": " + id+ ",\"qty\":" + qty + "}}";
ObjectMapper mapper = new ObjectMapper();
JsonFactory factory = mapper.getFactory();
JsonParser parser = factory.createParser(jsonString);
JsonNode actualObj = mapper.readTree(parser);
response = webResource.header("Authorization", "Bearer " + this.token).type("application/json")
.post(ClientResponse.class, actualObj);
I have error
Illegal character in path at index 52: https://test.com/rest/V1/cart/"IerwexsKLchKYmZ1ryKZkor9RdfJ2Dp3"/items
I am passing quoteId as parameter String quoteId="IerwexsKLchKYmZ1ryKZkor9RdfJ2Dp3";
How to remove quotes for quoteId from URL? Thank you.