public void downloadAttachment() throws Exception{ ZCRMRecord record=ZCRMRecord.getInstance("Leads",3719520000000659047L); FileAPIResponse responseIn=record.downloadAttachment(3719520000000992004L); String filepath="/Users/srivathsan-8829/Documents"; File file=new File(filepath+responseIn.getFileName()); System.out.println( "HTTP Status Code:"+responseIn.getStatusCode()); System.out.println( "File Name:"+responseIn.getFileName()); InputStream fin = responseIn.getFileAsStream(); int i=0; while((i=fin.read())!=-1){ System.out.print((char)i); } } |
public void downloadAttachments() throws Exception { CloseableHttpClient httpclient = HttpClients.createDefault(); HttpGet httpget = new HttpGet("{{api-domain}}/crm/v2/Leads/3719520000000659047/attachments/3719520000000991001"); httpget.addHeader("Authorization", "Zoho-oauthtoken 1000.9XXXX.6XXXX"); System.out.println("Request Type: "+httpget.getMethod()); HttpResponse httpresponse = httpclient.execute(httpget); Scanner sc = new Scanner(httpresponse.getEntity().getContent()); System.out.println(httpresponse.getStatusLine()); while(sc.hasNext()) { System.out.println(sc.nextLine()); } } |
public void deleteAttachment() throws Exception{ ZCRMRecord record=ZCRMRecord.getInstance("Leads",3719520000000659047L); APIResponse responseIn=record.deleteAttachment(3719520000000981001L); System.out.println( "Status:"+ responseIn.getMessage()); System.out.println( "Message:"+ responseIn.getStatus()); System.out.println("http code"+ responseIn.getStatusCode()); System.out.println( " Code:"+responseIn.getResponseJSON().toString()); } |
public void deleteAttachments() throws Exception { CloseableHttpClient httpclient = HttpClients.createDefault(); HttpDelete httpdelete = new HttpDelete("{{api-domain}}/crm/v2/Leads/3719520000000659047/attachments/3719520000000981001"); httpdelete.addHeader("Authorization", "Zoho-oauthtoken 1000.9XXXX.6XXXX"); System.out.println("Request Type: "+httpdelete.getMethod()); HttpResponse httpresponse = httpclient.execute(httpdelete); Scanner sc = new Scanner(httpresponse.getEntity().getContent()); System.out.println(httpresponse.getStatusLine()); while(sc.hasNext()) { System.out.println(sc.nextLine()); } } |
{ "data": [ { "code": "SUCCESS", "details": { "id": "3719520000000981001" }, "message": "record deleted", "status": "success" } ] } |
Writer is a powerful online word processor, designed for collaborative work.