Can't do mass delete for images

60 views
Skip to first unread message

Bourair Abdullah

unread,
Feb 26, 2014, 8:05:44 AM2/26/14
to roomor...@googlegroups.com
Hello API Support Team, 

We are facing a problem when trying to do mass delete for images , using the documentation here : 

We are getting the following error : 

org.springframework.web.client.HttpServerErrorException: 504 Gateway Timeout
	org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
	org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:532)
	org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:488)
	org.springframework.web.client.RestTemplate.execute(RestTemplate.java:446)
	org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:393)
	test.controller.booktController.getImages(booktController.java:143)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	java.lang.reflect.Method.invoke(Unknown Source)


Can you please help us with this ? and if it's from our side or not ? 

Our in Java is : 
public void massDeleteForImages(){
RestTemplate restTemplate = new RestTemplate();
HttpHeaders requestHeaders = new HttpHeaders();
String API = "Bearer AloOCMt5oUKeuA0CyQnkNnIBx5AuAo7FvfOpeXjM";
requestHeaders.set("Authorization", API);
requestHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
try{
HostnameVerifier verifier = new NullHostnameVerifier();
final MySimpleClientHttpRequestFactory factory = new MySimpleClientHttpRequestFactory(verifier);
restTemplate.setRequestFactory(factory);
ObjectMapper mapper = new ObjectMapper();

ImageIds images = new ImageIds(); 
images.setPropertyId(162780); 
images.setImages("1816882,1816883,1816884,1816885,1816886,1816887,1816888,1816889,1816890,1816891,1816892,1816893,1816894,1816895,1816896,1816897,1816898,1816899,1816900,1816901,1816902,1816903,1816904,1816905,1816906,1816907,1816908,1816909"); 
String serialize = mapper.writeValueAsString(images) ; 
HashMap<String, String> toHashMap = mapper.readValue(serialize, HashMap.class);
MultiValueMap<String, String> postParameters = new LinkedMultiValueMap<String, String>();
for (Entry<String, String> item: toHashMap.entrySet())
postParameters.add(item.getKey(), String.valueOf(item.getValue()));
HttpEntity<MultiValueMap<String, String>> requestEntity2 = new HttpEntity<MultiValueMap<String, String>>(postParameters, requestHeaders);
ResponseEntity<String> call = restTemplate.exchange("https://api.staging.roomorama.com/v1.0/host/rooms/162780/images.json" , HttpMethod.DELETE, requestEntity2, String.class);
System.out.println(call);
}catch(Exception e){
// Exception
}
}

Thanks, 

Reply all
Reply to author
Forward
0 new messages