Archive:OpenSUSE:Connect API
Accessing API
To access API, you have to choose in what format you want your results. Possible values are:
- php
- json
- xml
Then obviously, you need to choose the method and parameters, and you also may need some credentials. Then you can use GET or POST to access methods on following URL:
http://connect.opensuse.org/services/api/rest/${format}/?method=${method}&api_key=${key}
Replacing ${format}, ${method}, and ${key} with correct values.
Currently available API
List of available API commands on connect.o.o
system.api.list (GET)
Takes no argument and returns list of all methods supported and their parameters.
connect.user.groups.get (GET)
Takes one argument login - users username. And it will return list of the groups the user is a member of with some basic properties of that groups.
connect.user.groups.add (POST)
Takes two arguments login (users username) and group_guid (group id). It will add the user to the group without asking, overriding all restriction that group may have.
connect.user.groups.requestjoin (POST)
Takes two arguments login (users username) and group_guid (group id). It will creat join request to the specified group.
connect.user.create (POST)
Creates and new user according to the arguments. Required parameters are login, email and password. Optionally you can specify name. If you also set validate to false, user will be activated without verification of e-mail provided.
connect.user.attribute.get (GET)
Takes two arguments login and attribute. First one is obligatory, second one is optional. As in previous case, login is users username. Optional attribute argument can specify the user's property you are interested in. If no attribute is given or if attribute is *, this method will return all associated metadata (it will NOT return all user properties, just optional profile metadata).
connect.entity.attribute.get (GET)
Similar to previous method, only difference is that instead of login it takes guid as an argument and can access any object if you know what are you asking for.
Takes two arguments guid and attribute. First one is obligatory, second one is optional. guid is an unique internal entity identifier. Optional attribute argument can specify the entity's property you are interested in. If no attribute is given or if attribute is *, this method will return all associated metadata (it will NOT return all entity properties, just optional metadata).
connect.user.attribute.set (POST)
Takes three arguments login, attribute and value. All of them are is obligatory. login is users username. attribute argument can specify the user's property you are interested in and value is the value you want to set it to.
connect.entity.attribute.set (POST)
Similar to previous method, only difference is that instead of login it takes guid as an argument and can access any object if you know what are you asking for.
Takes three arguments guid, attribute and value. All of them are is obligatory. guid is internal object id. attribute argument can specify the objects's property you are interested in and value is the value you want to set it to.
connect.whoami
This method requires only public key you received for your application. It will return description of your key as recorded inside the connect.
Modifying the API
Whole our API is implemented in plugin called connect_api. Check the sources for details (they are documented) and Elgg documentation about REST API for more informations.