wallabag/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig

64 lines
3.3 KiB
Twig
Raw Normal View History

2016-02-16 19:18:59 +00:00
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}How to create my first application{% endtrans %}{% endblock %}
{% block css %}
{{ parent() }}
2016-03-07 07:58:08 +00:00
<link rel="stylesheet" href="{{ asset('https://cdnjs.cloudflare.com/ajax/libs/prism/1.4.1/themes/prism-dark.min.css') }}">
2016-02-16 19:18:59 +00:00
{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel settings">
<div class="row">
2016-03-07 08:20:20 +00:00
<p>{% trans %}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.{% endtrans %}</p>
<p>{% trans %}You need a token to communicate between your 3rd application and wallabag API.{% endtrans %}</p>
<p>{% trans with {'%link%': path('developer_create_client')} %}To create this token, you need <a href="%link%">to create a new client</a>.{% endtrans %}</p>
<p>{% trans %}Now, create your token (replace client_id, client_secret, username and password with the good values):{% endtrans %}</p>
2016-02-16 19:18:59 +00:00
<p>
<pre><code class="language-bash">http POST http://v2.wallabag.org/oauth/v2/token \
grant_type=password \
client_id=12_5um6nz50ceg4088c0840wwc0kgg44g00kk84og044ggkscso0k \
client_secret=3qd12zpeaxes8cwg8c0404g888co4wo8kc4gcw0occww8cgw4k \
username=yourUsername \
password=yourPassw0rd</code></pre>
</p>
2016-03-07 08:20:20 +00:00
<p>{% trans %}The API will return a response like this:{% endtrans %}</p>
2016-02-16 19:18:59 +00:00
<p>
<pre><code class="language-bash">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"
}</code></pre>
</p>
2016-03-07 08:20:20 +00:00
<p>{% trans %}The access_token is useful to do a call to the API endpoint. For example:{% endtrans %}</p>
2016-02-16 19:18:59 +00:00
<p>
<pre><code class="language-bash">http GET http://v2.wallabag.org/api/entries.json \
"Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"</code></pre>
</p>
2016-03-07 08:20:20 +00:00
<p>{% trans %}This call will return all the entries for your user.{% endtrans %}</p>
<p>{% trans with {'%link%': path('nelmio_api_doc_index')} %}If you want to see all the API endpoints, you can have a look <a href="%link%">to our API documentation</a>.{% endtrans %}</p>
2016-02-16 19:18:59 +00:00
<p><a href="{{ path('developer') }}" class="waves-effect waves-light grey btn">{% trans %}Back{% endtrans %}</a></p>
</div>
</div>
</div>
</div>
2016-03-07 07:58:08 +00:00
<script src="{{ asset('https://cdnjs.cloudflare.com/ajax/libs/prism/1.4.1/prism.min.js') }}"></script>
<script src="{{ asset('https://cdnjs.cloudflare.com/ajax/libs/prism/1.4.1/components/prism-bash.min.js') }}"></script>
2016-02-16 19:18:59 +00:00
{% endblock %}