mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-02 16:38:38 +00:00
Added developer documentation
This commit is contained in:
parent
24152cdb5e
commit
b6321bed7b
5 changed files with 131 additions and 3 deletions
|
@ -12,6 +12,8 @@ class DeveloperController extends Controller
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @Route("/developer", name="developer")
|
* @Route("/developer", name="developer")
|
||||||
|
*
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
public function indexAction(Request $request)
|
public function indexAction(Request $request)
|
||||||
{
|
{
|
||||||
|
@ -22,6 +24,8 @@ class DeveloperController extends Controller
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @Route("/developer/client/create", name="create_client")
|
* @Route("/developer/client/create", name="create_client")
|
||||||
|
*
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
public function createClientAction(Request $request)
|
public function createClientAction(Request $request)
|
||||||
{
|
{
|
||||||
|
@ -33,6 +37,19 @@ class DeveloperController extends Controller
|
||||||
|
|
||||||
return $this->render('WallabagCoreBundle:Developer:client.html.twig', array(
|
return $this->render('WallabagCoreBundle:Developer:client.html.twig', array(
|
||||||
'client_id' => $client->getPublicId(),
|
'client_id' => $client->getPublicId(),
|
||||||
|
'client_secret' => $client->getSecret(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @Route("/developer/howto/first-app", name="howto-firstapp")
|
||||||
|
*
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function howtoFirstAppAction(Request $request)
|
||||||
|
{
|
||||||
|
return $this->render('WallabagCoreBundle:Developer:howto_app.html.twig');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,24 @@
|
||||||
{% extends "WallabagCoreBundle::layout.html.twig" %}
|
{% extends "WallabagCoreBundle::layout.html.twig" %}
|
||||||
|
|
||||||
{% block title %}{% trans %}New client{% endtrans %}{% endblock %}
|
{% block title %}{% trans %}New application{% endtrans %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12">
|
||||||
|
<div class="card-panel settings">
|
||||||
|
|
||||||
Client ID: {{ client_id }}
|
<div class="row">
|
||||||
|
<h3>My application parameters</h3>
|
||||||
|
<p>Here are your application parameters.</p>
|
||||||
|
<ul>
|
||||||
|
<li>Client ID: {{ client_id }}</li>
|
||||||
|
<li>Client Secret: {{ client_secret }}</li>
|
||||||
|
</ul>
|
||||||
|
<a class="waves-effect waves-light btn" href="{{ path('developer') }}">Back to Developer main page</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
{% extends "WallabagCoreBundle::layout.html.twig" %}
|
||||||
|
|
||||||
|
{% block title %}{% trans %}How to create my first application{% endtrans %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12">
|
||||||
|
<div class="card-panel settings">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<p>The following commands make use of the <a href="https://github.com/jkbrzt/httpie">HTTPie library</a>. Make sure it is installed on your system before using it.</p>
|
||||||
|
<p>You need a token to communicate between your 3rd application and wallabag API.</p>
|
||||||
|
<p>To create this token, you need <a href="{{ path('create_client') }}">to create a new client</a>.</p>
|
||||||
|
<p>Now, create your token (replace client_id, client_secret, username and password with the good values):</p>
|
||||||
|
<p>
|
||||||
|
<code>
|
||||||
|
<pre>
|
||||||
|
http POST http://v2.wallabag.org/oauth/v2/token \
|
||||||
|
grant_type=password \
|
||||||
|
client_id=12_5um6nz50ceg4088c0840wwc0kgg44g00kk84og044ggkscso0k \
|
||||||
|
client_secret=3qd12zpeaxes8cwg8c0404g888co4wo8kc4gcw0occww8cgw4k \
|
||||||
|
username=yourUsername \
|
||||||
|
password=yourPassw0rd
|
||||||
|
</pre>
|
||||||
|
</code>
|
||||||
|
</p>
|
||||||
|
<p>The API will return a response like this:</p>
|
||||||
|
<p>
|
||||||
|
<code>
|
||||||
|
<pre>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Cache-Control: no-store, private
|
||||||
|
Connection: close
|
||||||
|
Content-Type: application/json
|
||||||
|
Date: Tue, 06 Oct 2015 18:24:03 GMT
|
||||||
|
Host: localhost:8000
|
||||||
|
Pragma: no-cache
|
||||||
|
X-Debug-Token: be00a1
|
||||||
|
X-Debug-Token-Link: /profiler/be00a1
|
||||||
|
X-Powered-By: PHP/5.5.9-1ubuntu4.13
|
||||||
|
{
|
||||||
|
"access_token": "ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw",
|
||||||
|
"expires_in": 3600,
|
||||||
|
"refresh_token": "ODBjODU1NWUwNmUzZTBkNDQ5YWVlZTVlMjQ2Y2I0OWM2NTM1ZGM2M2Y3MDhjMTViM2U2MzYxYzRkMDk5ODRlZg",
|
||||||
|
"scope": null,
|
||||||
|
"token_type": "bearer"
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</code>
|
||||||
|
</p>
|
||||||
|
<p>The access_token is useful to do a call to the API endpoint. For example:</p>
|
||||||
|
<p>
|
||||||
|
<code>
|
||||||
|
<pre>
|
||||||
|
http GET http://v2.wallabag.org/api/entries.json \
|
||||||
|
"Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"
|
||||||
|
</pre>
|
||||||
|
</code>
|
||||||
|
</p>
|
||||||
|
<p>This call will return all the entries for your user.</p>
|
||||||
|
<p>If you want to see all the API endpoints, you can have a look <a href="{{ path('nelmio_api_doc_index') }}">to our API documentation</a>.</p>
|
||||||
|
<p><a class="waves-effect waves-light btn" href="{{ path('developer') }}">Back to Developer main page</a></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -3,7 +3,31 @@
|
||||||
{% block title %}{% trans %}Developer{% endtrans %}{% endblock %}
|
{% block title %}{% trans %}Developer{% endtrans %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12">
|
||||||
|
<div class="card-panel settings">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<h3>Welcome to the wallabag API</h3>
|
||||||
|
|
||||||
|
<h4>Documentation</h4>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="{{ path('howto-firstapp') }}">How to create my first application</a></li>
|
||||||
|
<li><a href="{{ path('nelmio_api_doc_index') }}">View full API documentation</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h4>My applications</h4>
|
||||||
|
<ul>
|
||||||
|
<li><a href="{{ path('create_client') }}">Create a new application</a></li>
|
||||||
|
<li><a href="#">See my applications</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<a href="{{ path('create_client') }}">Create a new client</a>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
<li><a href="{{ path('import_pocket') }}">{% trans %}Migrate from Pocket{% endtrans %}</a></li>
|
<li><a href="{{ path('import_pocket') }}">{% trans %}Migrate from Pocket{% endtrans %}</a></li>
|
||||||
<li><a href="{{ path('import_wallabag_v1') }}">{% trans %}Migrate from wallabag v1{% endtrans %}</a></li>
|
<li><a href="{{ path('import_wallabag_v1') }}">{% trans %}Migrate from wallabag v1{% endtrans %}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<h4>{% trans %}Developers{% endtrans %}</h4>
|
||||||
|
<ul>
|
||||||
|
<li><a href="{{ path('developer') }}">{% trans %}Create your third application{% endtrans %}</a></li>
|
||||||
|
</ul>
|
||||||
<h4>{% trans %}Full documentation{% endtrans %}</h4>
|
<h4>{% trans %}Full documentation{% endtrans %}</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="http://wallabag.readthedocs.org">{% trans %}Convert your articles into ePUB or PDF{% endtrans %}</a></li>
|
<li><a href="http://wallabag.readthedocs.org">{% trans %}Convert your articles into ePUB or PDF{% endtrans %}</a></li>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue