iosmacosblogswiki

OS X Wiki/Blog Server API


I'm working on a client app for iOS to edit the built-in Wiki/Blog on Mac OS X Server (Snow Leopard and Lion).

It seems that we are able to use MetaWeblog , Atom API(I've tried but failed) or XML-RPC. However, I can't find any API document for it.

So my question is, where can I find the documents, or some open source samples? All samples I found can't deal with the OS X Server.

Much appreciate!

Update:

Heres the standard structure of the Wiki system:

I can't even get the list of the 'group_name' under ~/Groups/

Wiki Structure


Solution

  • The javascript source code for the wiki is not obfuscated, and it seems simple enough to serve as documentation. For example, the authentication process:

    sendAuthenticationPlain: function() {
        $('webauth').addClassName('verifying').removeClassName('error');
        var username = $F('username');
        var password = $F('password');
        var csrf = $F('authenticity_token');
        var plainResponse = "username="+username+"&password="+password
        this.setRememberMeCookie();
        var ajaxReq = new Ajax.Request(window.location.protocol + '//' + window.location.host + "/auth/plain_login", {
            method: 'post',
            requestHeaders: {'X-CSRF-Token': csrf},
            onComplete: this.gotAuthentication.bind(this),
            postBody: plainResponse
        });
        return false;
    },
    gotAuthentication: function(origRequest) {
        if (origRequest.responseJSON) {
            var jsonObject = origRequest.responseJSON
            if (jsonObject['success']) {
                var redirect = jsonObject['redirect'];
                var authToken = jsonObject['auth_token'];
                this.successCallback(authToken, redirect);
            } else {
                var errorString = jsonObject['error_string']
                this.failureCallback(errorString);
            }
        }
    },
    

    So you send a POST request to auth/plain_login, containing just the username/password in the POST data and an X-CSRF-Token header who's value comes from the <input type="hidden" name="authenticity_token" /> element on the page. The server returns a JSON string containing 'success' boolean.

    You can also use safari/chrome's developer tools to monitor ajax requests to/from the server, for example this is the JSON contents of a PUT request to save a wiki page:

    wiki save put request