Hello,
I'm trying to use the CRM Dynamics 2016 Web API through java to perform an update on an existing object in dynamics. So far i've had no problems with the API for gets and inserts. But the Update method keeps returning me 405 not auhtorized.
HttpURLConnection connection = null;
System.out.println("campaignId -> " + campaignId);
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("(BLURRED)", 8080));
connection = (HttpURLConnection) new URL(SERVICE_ROOT_URL_IR + "campaigns(" + campaignId + ")").openConnection(proxy);
connection.setRequestProperty("X-HTTP-Method", "PATCH");
connection.setRequestMethod("POST");
connection.setRequestProperty("OData-MaxVersion", "4.0");
connection.setRequestProperty("OData-Version", "4.0");
connection.setRequestProperty("Accept", "application/json");
connection.addRequestProperty("Authorization", "Bearer " + token);
connection.setUseCaches(false);
connection.setRequestProperty("Content-Type", "application/json");
connection.setDoOutput(true);
connection.connect();
This is the code example of the request. I then simply send the JSON object with the parameters to update.
*This post is locked for comments
I have the same question (0)