Working with the WSAPI code

From PeopleAggregator

Jump to: navigation, search

In progress.

Adding a new WSAPI method

  • edit tools/webapiwrappergen/peepagg.api and copy a similar existing method. Give it a new name, and edit the arguments and returned data as required.
  • run tools/webapiwrappergen/build.sh to compile peepagg.api into the API descriptor files used by the WSAPI code.
  • edit web/api/lib/api_impl.php and add the implementation for your new API method. If your method is called peopleaggregator.myNewMethod, the function definition should look like:
function peopleaggregator_myNewMethod($args)
  • ideally, also edit tools/api_test/test_api.py and add some tests for your new api method.

Drop Phil a line if you have trouble.

Running the automated API test

The API test requires you to create the following before it will work properly:

  • three users
  • two groups (created by the first user)

Create a file called config.txt in the tools/api_test directory, looking like this:

LOGIN = 'first username'
PASSWORD = 'password for first user'
LOGIN2 = 'second username'
PASSWORD2 = 'password for second user'
SAMPLE_USER_IDS = (2, 3) # user IDs of second and third users
SAMPLE_USER_NAMES = ('second username', 'third username') # login names of second and third users
SAMPLE_GROUP_IDS = (3, 4) # group IDs for two groups
Personal tools