private static JObject CreateJsonBody(string field, string id, LinkAccessControl accessControl) { var parameters = new JObject(); parameters[field] = id; if (accessControl != null) { parameters[RestApiConstants.ACCESS_CONTROL] = AccessControlConverter.ToJsonObject(accessControl); } return(parameters); }
public void UpdateLink(string userId, string linkId, LinkAccessControl accessControl) { var updateLinkRequest = CreateRestRequest(URI_RESOURCE + linkId, Method.PUT, ContentType.APPLICATION_JSON); var parameters = new JObject(); parameters[RestApiConstants.ACCESS_CONTROL] = AccessControlConverter.ToJsonObject(accessControl); updateLinkRequest.AddParameter(ContentType.APPLICATION_JSON, parameters.ToString(), ParameterType.RequestBody); var result = Execute <Link>(GetOAuthInfo(userId), updateLinkRequest); ValidateResponse(result, new StatusCodeResponseHandler(HttpStatusCode.NoContent)); }