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

Help with Basic HTTP Authentication (pretty simple question)
Hello,
I can't get this code to work. I keep getting the response, "{"Code":50,"Message":"Must supply a valid HTTP Basic Authorization header"}".
I'm trying to get data from Campaign Monitor, as shown here.
Here is the code I'm using:
Are my headers missing info? I can't firgure out what it's looking for.
Thanks!
I can't get this code to work. I keep getting the response, "{"Code":50,"Message":"Must supply a valid HTTP Basic Authorization header"}".
I'm trying to get data from Campaign Monitor, as shown here.
Here is the code I'm using:
Http httpProtocol = new Http(); HttpRequest request = new HttpRequest(); request.setEndPoint('https://api.createsend.com/api/v3.1/clients.json'); Blob headerValue = Blob.valueOf('u:' + '34534j5hk34j5hk34j5hk3j45hk3j'); //not my actual API key :) String authorizationHeader = EncodingUtil.base64Encode(headerValue); request.setHeader('Authorization', 'Basic ' + authorizationHeader); //I've also tried it like this: request.setHeader('Authorization', authorizationHeader); request.setMethod('GET'); HttpResponse response = httpProtocol.send(request); System.debug(response.getBody());
Are my headers missing info? I can't firgure out what it's looking for.
Thanks!
All Answers
That basically set me on the right track of exactly what to convert to base64.