+ Start a Discussion
khaviya G Senthilkumarkhaviya G Senthilkumar 

{"message":"Missing Authentication Token"}

          I am trying to do a POST request. But I keep getting this message in my endpoint. My code shows no error and the JSON is getting printed in the debug window. but I don't know what am doing wrong.
Please help me with this.

public  with sharing class SageAPIController  extends TriggerHandler {
     @future (callout=true)
    public static void getCustomerId(String acc)
         HttpRequest req = new HttpRequest();
         req.setEndpoint('  xxxxxxx ');
         req.setHeader('Content-Type', 'application/json;charset=UTF-8');
         Http h = new Http();
         HttpResponse response = h.send(req);
         String str = response.getBody();
         if (response.getStatusCode() != 200) 
             System.debug('The status code returned was not expected: ' + response.getStatusCode() + ' ' + response.getStatus());
    public override void beforeInsert() {
    for(Account Acc_record : (List<Account>) Trigger.new) {
         String jsonString  = '{"name": "'+Acc_record.Name+'", "display_contact": { "print_as": "'+Acc_record.Name+'","company_name": "'+Acc_record.Name+'", "email1": "'+Acc_record.McLabs2__Email__c+'"  ,"fax": "'+Acc_record.Fax+'","first_name": "'+Acc_record.Owner_Name__c+'","phone1": "'+Acc_record.Phone+'","mailaddress": { "address1": "'+Acc_record.BillingStreet+'", "city": "'+Acc_record.BillingCity+'", "state": "'+Acc_record.BillingState+'" }"} }';