You need to sign in to do that
Don't have an account?

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
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
http://100pulse.com/http-statuscode/415.jsp