AnsweredAssumed Answered

how to update lead info via REST

Question asked by 5ca07cb01b4d99c8b238ec2e252295ad69ae3848 on Jan 18, 2018
Latest reply on Jan 18, 2018 by Sanford Whiteman

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();

Outcomes