on 01-24-2014 01:32 PM
Hi,
I am from CUPM team at Cisco. I am trying to create a DistrilbutionList in UC. I got error code 415. The error message is: "= Unsupported Media Type. The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method." Here is the code that I passed in the Post request. The input xmlDL to POST = <?xml version="1.0" encoding="UTF-8" standalone="yes"?><DistributionLists><DistributionList><Alias>turtle_1</Alias><DisplayName>Turtle One</DisplayName><IsPublic>true</IsPublic><Undeletable>false</Undeletable><DtmfAccessId>80001</DtmfAccessId><AllowContacts>false</AllowContacts><AllowForeignMessage>false</AllowForeignMessage><PartitionObjectId>/vmrest/partitions/f46a1105-1cfa-4be9-89eb-e43133add5f1</PartitionObjectId><PartitionURI>f46a1105-1cfa-4be9-89eb-e43133add5f1</PartitionURI><DistributionListMembersURI></DistributionListMembersURI></DistributionList></DistributionLists>
try{
JAXBContext ctx = JAXBContext.newInstance(com.cisco.uc713.rest.dlist.DistributionLists.class);
StringWriter writer = new StringWriter();
Marshaller marshaller = ctx.createMarshaller();
marshaller.marshal(dlsPojo, writer);
String xmlDL = writer.toString();
System.out.println("&&& XML DistributionList = " + xmlDL);
....
try{
//post a request
ClientResponse restResponse = webResource.accept(MediaType.APPLICATION_XML_TYPE).post(ClientResponse.class, xmlDL);
Status status = restResponse.getClientResponseStatus();
code = status.getStatusCode();
data = restResponse.getEntity(String.class);
}catch (ClientHandlerException chx){
....
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: