Commits

Matt Ryall  committed 45bbd2d

JSON RPC example

  • Participants
  • Parent commits 5da549f

Comments (0)

Files changed (1)

+function jsonRpc(method, params, success, error) {
+    jQuery.ajax("http://wiki.example.com/rpc/json-rpc/confluenceservice-v2/" + method, {
+        dataType: "json",
+        type: "POST",
+        contentType: "application/json",
+        data: JSON.stringify(params),
+        success: success,
+        error: error
+    });
+}
+
+jsonRpc("getComments", [ AJS.params.pageId ], function (comments) {
+    jQuery.each(comments, function (i, comment) {
+        if (comment.creator == "mquail") {
+            jsonRpc("removeComment", [ comment.id ], function () {
+                console.log("Comment removed: " + comment.id);
+            });
+        }
+    });
+});
+