You need to sign in to do that
Don't have an account?
rajesh_y
please help me in http callouts
Hi am using following code in salesforce to integrate with campaign monitor. but i am getting errors like 12:47:38.666 (666977000)|CALLOUT_RESPONSE|[51]|System.HttpResponse[Status=Bad Request, StatusCode=400] 12:47:38.667 (667346000)|USER_DEBUG|[55]|DEBUG|********<?xml version="1.0" encoding="utf-8"?><Result><Code>400</Code><Message>Failed to deserialize your request. Please check the documentation and try again. Fields in error: client</Message></Result> Please solve my problem. public class lll { public string errormessage; public void Login() { Http h = new Http(); HttpRequest req = new HttpRequest(); //ErrorMessage=''; final string baseUrl = 'http://dskvapconsultancyservices.createsend.com/'; final string username = '05b88f78dfc4f00ce93553a79be93d04'; final string password = 'rajesh12'; string apikey='05b88f78dfc4f00ce93553a79be93d04'; Blob headerValue = Blob.valueOf(username + ':' + password); String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue); req.setHeader('Host','http://api.createsend.com'); req.setHeader('Content-length', '1753' ); req.setHeader('Content-Type', 'text/xml;charset=UTF-8'); req.setHeader('Authorization',authorizationHeader); //req.setHeader('Authorization','Basic 05b88f78dfc4f00ce93553a79be93d04=='); //req.setHeader('content-type', 'text/xml;charset=utf-8'); //req.setHeader('Content-Length','1024'); //req.setHeader('Host','http://dskvapconsultancyservices.createsend.com/'); //req.setHeader('Connection','keep-alive'); string body1='<?xml version="1.0" encoding="utf-8"?>'; body1+='<Clients> '; /*body1+='<ApiKey>05b88f78dfc4f00ce93553a79be93d04</ApiKey>'; body1+='<AccessDetails>'; body1+='<Username>05b88f78dfc4f00ce93553a79be93d04</Username>'; body1+='<AccessLevel>23</AccessLevel>'; body1+='</AccessDetails>';*/ body1+='<Client>'; body1+='<ClientID></ClientID>'; body1+='<Name></Name>'; body1+='</Client>'; body1+='</Clients>'; req.setMethod('GET'); req.setBody(body1); //req.setEndpoint(baseUrl + '?loginType=&un='+username+'&pw='+password); //req.setEndpoint('http://api.createsend.com/05b88f78dfc4f00ce93553a79be93d04/v3/clients/clients.xml'); req.setEndPoint('http://api.createsend.com/api/v3/clients.xml'); //req.setbody('http://api.createsend.com/api/v3/clients.xml'); HttpResponse res = h.send(req); //req.setEndpoint(baseUrl + 'apex/UploadFile_DifferentOrg'); //res = h.send(req); system.debug('********'+res.getbody()); if (res.getBody().indexOf('success=true')>-1) { system.debug('Success'); } } public void detail() { } }
thank you in advance
rajesh
I think you need POST
hi
same response am getting
now the code is like
the error is |System.HttpResponse[Status=Moved Temporarily, StatusCode=302]
</body></html>
DEBUG|********<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://api.createsend.com/">here</a>.</h2>
i need to get details
how its possible
please help me
hi
same response am getting
now the code is like
i need to get details
how its possible
please help me