function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LAKSHMAIAH CHAGANTILAKSHMAIAH CHAGANTI 

NEED TO SEND CSV FILE FROM SALESFORCE TO THIRD PARTY CLIENT

Hi folks,
I need a help from you, in my project there is a need to send csv files from salesforce to third  party client(java technology). For this we are using REST PUT service, and to connect and to send csv files from salesforce I coded as specifed below, I am getting the following error which is taken from my debug log file
DEBUG|System.HttpResponse[Status=Unsupported Media Type, StatusCode=415]

and the code is
     RESTInfo__c ri = RESTInfo__c.getInstance('cart');
            HttpRequest req = new HttpRequest();
            string url = ri.endpoint__c; // I mentioned endpoint url in custom settings
            req.setMethod('PUT');
            req.setEndpoint(url);
           // req.setHeader('Content-Type', ri.content_type__c ); //req.setHeader('content-type', 'application/csv');
            req.setHeader('email', ri.email__c);  //I mentioned endpoint email & password in custom settings
            req.setHeader('password', ri.password__c);  
            req.setHeader('carttype', ri.carttype__c);  
            req.setHeader('accountId', accMap.get(i).Account_ID__c); 
            req.setHeader('Content-Type', 'application/json');
            //req.setHeader('input', 'cart,cartcsv');
            req.setBody(cartCsv); 
            Http http = new Http();
            try {
                
                HTTPResponse res = http.send(req);
                System.debug('The response::::'+res);
                System.debug(res.toString());
                System.debug('STATUS:'+res.getStatus());
                System.debug('STATUS_CODE:'+res.getStatusCode());
                if(res.getStatus() != '200'){
                    isError = true;
                }
                
            }catch(System.CalloutException e) {
                system.debug('The exception :::'+e);
                isError = true;
                system.debug('Making error flag as true ::isError-'+isError);

Thanks in Advance
Iqrar AhmedIqrar Ahmed
Hi, I think your third party tool does'nt contain defination about csv see following link for details
http://100pulse.com/http-statuscode/415.jsp