|
a |
|
b/api/index.html |
|
|
1 |
<!DOCTYPE html>
|
|
|
2 |
<html>
|
|
|
3 |
<head>
|
|
|
4 |
<title>OSP Documentation</title>
|
|
|
5 |
<link rel="stylesheet" type="text/css" href="../docs_style.css">
|
|
|
6 |
</head>
|
|
|
7 |
|
|
|
8 |
<body>
|
|
|
9 |
<div id="site-header">
|
|
|
10 |
<div class="wrapper">
|
|
|
11 |
<a href="http://opensourceprojects.eu" id="header-logo"><img src="logo.png"></a>
|
|
|
12 |
</div>
|
|
|
13 |
</div>
|
|
|
14 |
|
|
|
15 |
<div id="content_base">
|
|
|
16 |
<h1>PROSE platform API</h1>
|
|
|
17 |
|
|
|
18 |
<p>One of the topics that came up during the Q&A for the <a title="PROSE Platform Webinar on Youtube" href="https://www.youtube.com/watch?v=GkXX1HAn86g" target="_blank">PROSE platform webinar</a> was the use of an API to interact with the <a title="Open Source Projects" href="http://opensourceprojects.eu">opensourceproject.eu</a> 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.</p>
|
|
|
19 |
|
|
|
20 |
<p>The PROSE platform is based on <a title="Allura at Apache.org" href="https://forge-allura.apache.org/p/allura">Allura</a>, the platform behind SourceForge, and provides the REST API described here. For starters the REST API is available under the path <strong>/rest/</strong> so for example if you want to access information about the project with path <strong>/p/osp/</strong>, you would make a GET request to <strong>/rest/p/osp/</strong>.
|
|
|
21 |
All of the API calls return JSON objects, unless an error occurs (e.g. 404).</p>
|
|
|
22 |
|
|
|
23 |
<p>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:</p>
|
|
|
24 |
|
|
|
25 |
<code><strong>http://opensourceprojects.eu/rest/p/osp/</strong>
|
|
|
26 |
{"tools": [{"mount_point": "admin", "name": "admin", "label": "Admin"}, {"mount_point": "search", "name": "search", "label": "Search"}, {"mount_point": "activity", "name": "activity", "label": "Activity"}, <strong>{"mount_point": "tickets", "name": "tickets", "label": "Tickets"}</strong>, {"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"}, <strong>{"mount_point": "docs", "name": "wiki", "label": "Documentation"}</strong>, {"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"}</code>
|
|
|
27 |
|
|
|
28 |
<p>For each tool in the JSON object there will be a <strong>label</strong> (the name of the tool in the sidebar), a <strong>name</strong> (the tool type, e.g. git, svn and a <strong>mount-point</strong> (the path were you can reach the tool).</p>
|
|
|
29 |
|
|
|
30 |
<p>Accessing each of the individual tools under a project is done by appending the <strong>mount-point</strong> to the base REST path to the project. From the previous example the REST path to access our documentation wiki is <strong>/rest/p/osp</strong> + <strong>/docs/</strong>. A GET request to a wiki tool will get you a list available wiki pages:</p>
|
|
|
31 |
|
|
|
32 |
<code><strong>http://opensourceprojects.eu/rest/p/osp/docs/</strong>
|
|
|
33 |
{"pages": ["SubProjects", "Tools", "GettingStarted", "Creating Private Projects"]}</code>
|
|
|
34 |
|
|
|
35 |
<p>You can request a specific page by appending the page name, to the wiki tool URL:</p>
|
|
|
36 |
|
|
|
37 |
<code><strong>http://opensourceprojects.eu/rest/p/osp/docs/GettingStarted</strong>
|
|
|
38 |
{"text": "Welcome to the OpenSourceProjects.eu documentation wiki.
|
|
|
39 |
(...)</code>
|
|
|
40 |
|
|
|
41 |
<p>If go back to the initial example we can get a list of tickets by following the same procedure</p>
|
|
|
42 |
|
|
|
43 |
<code><strong>http://opensourceprojects.eu/rest/p/osp/tickets/</strong>
|
|
|
44 |
{"tickets": [{"summary": "Add navigation bars", "ticket_num": 1},
|
|
|
45 |
(...)</code>
|
|
|
46 |
|
|
|
47 |
<p>You can get an individual ticket by appending the ticket_num as returned above to the tool path (<strong>/rest/p/osp/tickets/98</strong>).</p>
|
|
|
48 |
|
|
|
49 |
<p>This should cover the basics to get things started. I've created a more detailed <a href="http://opensourceprojects.eu/p/osp/api-demo/">demo</a> 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 <a href="http://bitergia.com/">Bitergia</a> tools (<a href="http://metricsgrimoire.github.io/Bicho/">Bicho</a>). If you need a more thorough overview of the API details check out the <a href="http://sourceforge.net/p/forge/documentation/Allura%20API/">SourceForge API page</a> which is compatible with the OpenSourceProject API.</p>
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
|
53 |
<div class="footer">
|
|
|
54 |
</div>
|
|
|
55 |
</body>
|
|
|
56 |
|
|
|
57 |
</html>
|