You need to sign in to do that
Don't have an account?
rajesh_y
Status=Unauthorized, StatusCode=401 An Authentication object was not found in the SecurityContext
public class constantcontact { public void conlist() { Http h = new Http(); HttpRequest req = new HttpRequest(); final string username = '54149b86-22eb-496b-a326-132dfa9f3786%rajesh_y'; final string password = 'Dskvap123'; Blob headerValue = Blob.valueOf(username); String authorizationHeader = 'BASIC ' +EncodingUtil.base64Encode(headerValue); //String authorizationHeader =username+':'+password; req.setHeader('Authorization',authorizationHeader); //req.setHeader('Content-length', '1753' ); req.setHeader('Host','https://api.constantcontact.com/ws/customers//contacts/1'); req.setHeader('Connection','keep-alive'); req.setHeader('Content-Type', 'application/atom+xml'); req.setMethod('GET'); req.setbody('https://api.constantcontact.com/ws/customers/rajesh_y/contacts'); req.setEndpoint('http://api.constantcontact.com/ws/customers/joesflowers/lists'); HttpResponse res = h.send(req); system.debug('********'+res.getbody()); } }
This code for getting all contacts from constantcontact to salesforce through http callouts
But i am getting error like
An Authentication object was not found in the SecurityContext
Status=Unauthorized, StatusCode=401
All credential are valid
whats problem in my code please help me
thank you in advance
rajesh
That error is coming from the server you're making your request to. There's not much we can do to help.