Parent: [596fe4] (diff)

Download this file

index.html    59 lines (39 with data), 4.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>
<head>
<title>OSP Documentation</title>
<link rel="stylesheet" type="text/css" href="../docs_style.css">
</head>
<body>
<div id="site-header">
<div class="wrapper">
<a href="http://opensourceprojects.eu" id="header-logo"><img src="../logo.png"></a>
</div>
</div>
<div id="content_base">
<h1>PROSE platform API</h1>
&lt;<a href="..">Back to Index</a>
<p>One of the topics that came up during the Q&amp;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>
<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>.
All of the API calls return JSON objects, unless an error occurs (e.g. 404).</p>
<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>
<code><strong>http://opensourceprojects.eu/rest/p/osp/</strong>
{"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>
<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>
<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>
<code><strong>http://opensourceprojects.eu/rest/p/osp/docs/</strong>
{"pages": ["SubProjects", "Tools", "GettingStarted", "Creating Private Projects"]}</code>
<p>You can request a specific page by appending the page name, to the wiki tool URL:</p>
<code><strong>http://opensourceprojects.eu/rest/p/osp/docs/GettingStarted</strong>
{"text": "Welcome to the OpenSourceProjects.eu documentation wiki.
(...)</code>
<p>If go back to the initial example we can get a list of tickets by following the same procedure</p>
<code><strong>http://opensourceprojects.eu/rest/p/osp/tickets/</strong>
{"tickets": [{"summary": "Add navigation bars", "ticket_num": 1},
(...)</code>
<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>
<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>
<div class="footer">
</div>
</body>
</html>