Ushahidi V2 has an extensible API; that means you can add new components to it (e.g. add new models to the API etc).
To do this, you need to:
- Add your new API component to the API configuration file, application/config/api.php, so the API knows which files to call when it sees your new type in the API call. For example, this lines were added to include Messages in the API:
- "messages" => "Admin_Messages",
- "messages" => "Admin_Messages",
- Add a file for your new API component to directory application/libraries/api, e.g. this file was added for Messages API:
- application/libraries/api/MY_Messages_Api_Object.php
- then add code specific to your new API type
- Optional: if you want admin-only for all or part of your API to be admin-access-only, then add a file for that too. e.g. this file was added for Admin Messages API:
- application/libraries/api/MY_Admin_Messages_Api_Object.php
- and add code specific to your new API type
- Add any new functions needed by the API to your model files, e.g. for Messages API, this file was edited:
- application/models/message.php
- application/models/message.php
That's it.