Queueable Apex callouts

Salesforce apex Queueable is allowed you to invoke the external systems by using callout and the below sample code shows how to make callouts from the Queueable apex.

Sample Code : 

This code is populating the  County currency based on the mailing country name  on the contact from external rest API by using callouts

public class PopulateCountryQueueable implements Queueable,Database.AllowsCallouts{
    public List<Contact> contacts; 
    public PopulateCountryQueueable(List<Contact> conList){
        contacts = conList ;
        
    }
    public void execute(QueueableContext qc){
        System.debug('contacts'+contacts[0]);
        Http h = new Http();
        HttpRequest httpReq = new HttpRequest();
        httpReq.setMethod('GET');
        httpReq.setHeader('Content-Type','application/json'); 
        httpReq.setEndpoint('http://countryapi.gear.host/v1/Country/getCountries');
        HttpResponse res = h.send(httpReq);
        System.debug('res'+res);
        JsonApex jsonP = (JsonApex)JSON.deserialize(res.getBody(),JsonApex.class);
        List<cls_Response> countries = jsonP.Response;
        
        for(Contact con :contacts ){
            for(cls_Response cntry : countries){
                if(cntry.Alpha3Code ==con.MailingCountry){
                    con.CurrencyCode__c = cntry.CurrencyCode ; 
                }
                
            }
            
        }
        update contacts;
        
    }
    
    public class JsonApex{
        public boolean IsSuccess{get;set;}
        public cls_UserMessage UserMessage{get;set;}
        public cls_TechnicalMessage TechnicalMessage{get;set;}
        public Integer TotalCount{get;set;}
        public cls_Response[] Response{get;set;}
    }
    public class cls_UserMessage {
    }
    class cls_TechnicalMessage {
    }
    public class cls_Response {
        public String Name {get;set;}
        public String Alpha2Code{get;set;}
        public String Alpha3Code{get;set;}
        public String NativeName{get;set;}
        public String Region{get;set;}
        public String SubRegion{get;set;}
        public String Latitude{get;set;}
        public String Longitude{get;set;}
        public Integer Area{get;set;}
        public Integer NumericCode{get;set;}
        public String NativeLanguage{get;set;}
        public String CurrencyCode{get;set;}
        public String CurrencyName{get;set;}
        public String CurrencySymbol{get;set;}
        public String Flag{get;set;}
        public String FlagPng{get;set;}
    }  
}

Remote Site Setting 

Please add the remote site setting. If you are using named credentials, you can skip this step

Invoke the Queueable Job 

You can invoke the Queueable job with below code the execute anonymous salesforce
List<Contact> con =[Select Id ,Name ,MailingCountry,CurrencyCode__c from Contact];
ID jobID = System.enqueueJob(new PopulateCountryQueueable(con));

Monitoring Job

after you submit your queueable class for execution, the job is added to the queue and will be processed when system resources become available. You can monitor the status of your job programmatically by querying AsyncApexJob or through the user interface in Setup by entering Apex Jobs in the Quick Find box, then be selecting Apex Jobs or By Running SOQL query on AsyncApexJob object as shown below. 

AsyncApexJob jobInfo = [SELECT Status,NumberOfErrors FROM AsyncApexJob WHERE Id=:jobID];