PROSE platform API

<Back to Index

One of the topics that came up during the Q&A for the PROSE platform webinar was the use of an API to interact with the platform. We didn't get the chance to go over it then, so this is a quick technical post introducing the platform API along with some examples.

The PROSE platform is based on Allura, the platform behind SourceForge, and provides the REST API described here. For starters the REST API is available under the path /rest/ so for example if you want to access information about the project with path /p/osp/, you would make a GET request to /rest/p/osp/. All of the API calls return JSON objects, unless an error occurs (e.g. 404).

Each project has a set of associated tools, so when you make a request for a project you get some metadata, and a list of all the tools under the project. Here is a quick example for the osp project: {"tools": [{"mount_point": "admin", "name": "admin", "label": "Admin"}, {"mount_point": "search", "name": "search", "label": "Search"}, {"mount_point": "activity", "name": "activity", "label": "Activity"}, {"mount_point": "tickets", "name": "tickets", "label": "Tickets"}, {"mount_point": "discussion", "name": "discussion", "label": "Discussion"}, {"mount_point": "allura", "name": "git", "label": "Allura"}, {"mount_point": "opensourceprojects", "name": "git", "label": "opensourceprojects"}, {"mount_point": "subversion", "name": "git", "label": "subversion"}, {"mount_point": "docs", "name": "wiki", "label": "Documentation"}, {"mount_point": "osp-docs", "name": "git", "label": "osp-docs"}, {"mount_point": "allura-contrib", "name": "git", "label": "Allura-Contrib"}, {"mount_point": "api-demo", "name": "git", "label": "api-demo"}], "name": "osp"}

For each tool in the JSON object there will be a label (the name of the tool in the sidebar), a name (the tool type, e.g. git, svn and a mount-point (the path were you can reach the tool).

Accessing each of the individual tools under a project is done by appending the mount-point to the base REST path to the project. From the previous example the REST path to access our documentation wiki is /rest/p/osp + /docs/. A GET request to a wiki tool will get you a list available wiki pages: {"pages": ["SubProjects", "Tools", "GettingStarted", "Creating Private Projects"]}

You can request a specific page by appending the page name, to the wiki tool URL: {"text": "Welcome to the documentation wiki. (...)

If go back to the initial example we can get a list of tickets by following the same procedure {"tickets": [{"summary": "Add navigation bars", "ticket_num": 1}, (...)

You can get an individual ticket by appending the ticket_num as returned above to the tool path (/rest/p/osp/tickets/98).

This should cover the basics to get things started. I've created a more detailed demo in python, that also shows the git tool at work. Finally remember that there are already open source tools that support parts of this API, the Bitergia tools (Bicho). If you need a more thorough overview of the API details check out the SourceForge API page which is compatible with the OpenSourceProject API.