+ Start a Discussion
subodh chaturvedi 17subodh chaturvedi 17 

How to Update the two picklist field from External system to Sales force through Rest API

Hello All,

I have queries related to Integration part as I am new to it. I have a requirement where I want to update the two picklists field data of contact (object ) in Salesforce from External System. I want to integrate through rest. can anyone let me know how to do this actions or anyone provide me the sample code to do it? 

What are the pre-requisite Required to do the authentication

Here is my code that i am trying to do.

Public Class statusPageCallout{

    public static void spageCallout(){
        List<Contact> con = new List<Contact>();
        con=[select Id,AccountId,System_Status_Request__c,System_Status_Participation_Level__c,email from Contact];
      //  String systemStatusReq =con.System_Status_Request__c;
        String api_Key = '89a229ce1a8dbcf9ff30430fbe35eb4c0426574bca932061892cefd2138aa4b1';
        String token;
        String requestEndpoint = 'https://api.statuspage.io/v1/pages';
      //  requestEndpoint += '?q='+System_Status_Request__c;        
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setHeader('Content-Type', 'application/jason; charset=utf-8');
      //  request.setBody();
        HttpResponse response = http.send(request);

        // If the request is successful, parse the JSON response.
        if (response.getStatusCode() == 200) {

           // Deserialize the JSON string into collections of primitive data types.
       Map<String, Object> results = (Map<String,Object>) JSON.deserializeUntyped(response.getBody());
       Map<String, Object> mainResults = (Map<String, object>)(results.get('pages'));
   /*     System.debug('Received the following animals:');
            for (Object pages: mainResults) {
             //   System.debug(pages);
    }else {
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'There was an error retrieving  information.');