From abc329453be6381bcf4d1b0dfd9f698312ed3b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 16 Feb 2016 13:49:25 +0100 Subject: Enhance documentation and create a form to create a new client --- .../themes/material/Developer/client.html.twig | 21 +++++++++----- .../material/Developer/client_parameters.html.twig | 25 +++++++++++++++++ .../themes/material/Developer/howto_app.html.twig | 32 +++++++++------------- .../themes/material/Developer/index.html.twig | 12 ++++---- 4 files changed, 58 insertions(+), 32 deletions(-) create mode 100644 src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig (limited to 'src/Wallabag/CoreBundle/Resources/views/themes/material') diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig index 08d1cb15..061f4631 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig @@ -8,13 +8,20 @@
-

My client parameters

-

Here are your client parameters.

-
    -
  • Client ID: {{ client_id }}
  • -
  • Client secret: {{ client_secret }}
  • -
- Back to Developer main page +

{% trans %}You will create a new client. Please fill the field below for the redirect URI of your application:{% endtrans %}

+ {{ form_start(form) }} + {{ form_errors(form) }} +
+ {{ form_label(form.redirect_uris) }} + {{ form_errors(form.redirect_uris) }} + {{ form_widget(form.redirect_uris) }} +
+ + + {% trans %}Back{% endtrans %} +
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig new file mode 100644 index 00000000..8e3966b9 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig @@ -0,0 +1,25 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}Client parameters{% endtrans %}{% endblock %} + +{% block content %} +
+
+
+
+

{% trans %}Here are your client parameters.{% endtrans %}

+

{% trans %}Make sure to copy these parameters now. You won’t be able to see them again!{% endtrans %}

+
    +
  • {% trans %}Client ID:{% endtrans %}
    {{ client_id }}
  • +
  • {% trans %}Client secret:{% endtrans %}
    {{ client_secret }}
  • +
+ + {% trans %}Back{% endtrans %} + {% trans %}Read the howto "Create my first application"{% endtrans %} +
+
+ +
+
+ +{% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig index 2db15b16..497bb308 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig @@ -2,6 +2,11 @@ {% block title %}{% trans %}How to create my first application{% endtrans %}{% endblock %} +{% block css %} + {{ parent() }} + +{% endblock %} + {% block content %}
@@ -13,22 +18,16 @@

To create this token, you need to create a new client.

Now, create your token (replace client_id, client_secret, username and password with the good values):

- -

-http POST http://v2.wallabag.org/oauth/v2/token \
+                    
http POST http://v2.wallabag.org/oauth/v2/token \
     grant_type=password \
     client_id=12_5um6nz50ceg4088c0840wwc0kgg44g00kk84og044ggkscso0k \
     client_secret=3qd12zpeaxes8cwg8c0404g888co4wo8kc4gcw0occww8cgw4k \
     username=yourUsername \
-    password=yourPassw0rd
-                        
- + password=yourPassw0rd

The API will return a response like this:

- -

-HTTP/1.1 200 OK
+                    
HTTP/1.1 200 OK
 Cache-Control: no-store, private
 Connection: close
 Content-Type: application/json
@@ -44,25 +43,20 @@ X-Powered-By: PHP/5.5.9-1ubuntu4.13
     "refresh_token": "ODBjODU1NWUwNmUzZTBkNDQ5YWVlZTVlMjQ2Y2I0OWM2NTM1ZGM2M2Y3MDhjMTViM2U2MzYxYzRkMDk5ODRlZg",
     "scope": null,
     "token_type": "bearer"
-}
-                        
- +}

The access_token is useful to do a call to the API endpoint. For example:

- -

-http GET http://v2.wallabag.org/api/entries.json \
-    "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"
-                        
- +
http GET http://v2.wallabag.org/api/entries.json \
+    "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"

This call will return all the entries for your user.

If you want to see all the API endpoints, you can have a look to our API documentation.

-

Back to Developer main page

+

{% trans %}Back{% endtrans %}

+ {% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig index 3507b654..b983883f 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig @@ -8,18 +8,18 @@
-

Welcome to the wallabag API

+

{% trans %}Welcome to the wallabag API{% endtrans %}

-

Documentation

+

{% trans %}Documentation{% endtrans %}

-

My clients

+

{% trans %}Clients{% endtrans %}

-- cgit v1.2.3