3 Replies Latest reply on Jan 18, 2018 11:24 PM by Sanford Whiteman

    how to update lead info via REST

    Vic Chen

      hi

      i try update lead info via REST, i use java. and my access be denied. {"requestId":"6a5e#1610d0b1142","success":false,"errors":[{"code":"603","message":"Access denied"}]}

      can someone help me please.

       

      URL url = new URL("https://004-BTR-463.mktorest.com/rest/v1/leads.json?access_token=31f4204f-52b0-4e08-b7cf-e81008e0fdf9:ab ");

      HttpsURLConnection urlConn = (HttpsURLConnection) url.openConnection();

      urlConn.setRequestMethod("POST");

      urlConn.setRequestProperty("Accept", "application/json");

      urlConn.setRequestProperty("Content-Type","application/json; charset=UTF-8");

      urlConn.setDoOutput(true);

      urlConn.setDoInput(true);

      urlConn.setUseCaches(false);

      urlConn.setAllowUserInteraction(true);

      DataOutputStream writer = new DataOutputStream(os);

      syncLeadRequest =

      {

        "action": "updateOnly",

        "lookupField": "id",

        "input": [

          {

            "id": "").append(leadId).append("",

            "objectTypeOfSFDCALT": "objectTypeOfSFDCALT",

            "objectIdOfSFDCALT": "objectIdOfSFDCALT",

            "lastSyncedDateToSFDCALT": "Date"

          }

        ]

      }

       

      writer.writeBytes(syncLeadRequest);

      writer.flush();

      writer.close();

      os.close();