[Freeipa-users] JSON-RPC documentation?

Petr Viktorin pviktori at redhat.com
Tue Jan 15 11:37:02 UTC 2013


Hello Brian,

On 01/15/2013 03:55 AM, Brian Smith wrote:
> That helps a lot.  Thanks!  I would use ipalib, but I'm developing a
> Rails application, so the JSON interface is the quickest (and since XML
> may be deprecated)

While XML may be deprecated, it'll stick around for a long time. But 
JSON is a good choice.

> best way forward (unless you know a way to use it in
> Ruby :).  I'm guessing in JSON, the structure would look something like
> this:
>
> {
>    "method": "user_add",
>    "params": [
>      [],
>      {
>        "uid":"testuser",
>        "givenname":"Test",
>        "sn":"User",
>        "userpassword":"mySecretPasswordBlahBlah"
>        ...
>      }
>    ]
> }
>
> Maybe I'll try to compile some documentation.  I know that this page
> helped a lot, to cook up a quick ruby client with Curb:
> http://adam.younglogic.com/2010/07/talking-to-freeipa-json-web-api-via-curl/
>

I've just CC-d you on a patch to the devel list that switches the IPA 
client to JSON-RPC. To use it:

- Check out the git master and apply the patch
- Copy /etc/ipa/default.conf to ~/.ipa/default.conf
- Now a command like `./ipa -vv user-find` will print out the JSON it 
sends & receives.
It dumps the whole request/response so the output is not ideal for your 
use, but I'm sure you can handle it.
It works from the source tree, no build/installation required.


You probably found out that the CLI options and API options/LDAP 
attributes sometimes have different names. The `ipa show-mappings` 
command can give you a mapping table.


One more thing: please add the API version to your requests to prevent 
surprises down the road. The official client doesn't currently always do 
that; this is a bug. You can get the current version with `ipa ping`:

$ ipa ping
------------------------------------------
IPA server version 3.1.0. API version 2.47
------------------------------------------

{
    "method": "user_add",
    "params": [
      [],
      {
        "uid":"testuser",
        "givenname":"Test",
        "sn":"User",
        "userpassword":"mySecretPasswordBlahBlah"
        ...
        "version": "2.47",
      }
    ]
}

-- 
Petr³




More information about the Freeipa-users mailing list