Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [kapua-dev] REST API SDK

My idea is that user provides URL and credentials only and we hide token passing and refreshing from her. This is pretty easy to achieve by creating such thin wrapper around Swagger generated Java code.

wt., 4 kwi 2017 o 09:41 użytkownik Jens Reimann <jreimann@xxxxxxxxxx> napisał:
Ah .. ok! :)

Thanks!

On Tue, Apr 4, 2017 at 9:35 AM, Henryk Konsek <hekonsek@xxxxxxxxx> wrote:
Yeah, Benjamin is right :) My example uses default constructor which uses default "kapua-sys" username with an appropriate password. But you could set your own credentials together with a connection URL :) .

wt., 4 kwi 2017 o 09:29 użytkownik Benjamin Cabé <benjamin@xxxxxxxxxxx> napisał:

The Kapua(String apiAddress) API will use the default kapua-sys/kapua-password credentials. There is another constructor that allows for actual credentials to be passed :-)

 

De : <kapua-dev-bounces@xxxxxxxxxxx> au nom de Jens Reimann <jreimann@xxxxxxxxxx>
Répondre à : kapua developer discussions <kapua-dev@xxxxxxxxxxx>
Date : mardi 4 avril 2017 à 09:26
À : kapua developer discussions <kapua-dev@xxxxxxxxxxx>
Objet : Re: [kapua-dev] REST API SDK

 

But in that example, I don't see how the token or user credentials get provided. From what I see at the example, everyone knowing the IP address can query for users? But I am probably wrong there.

 

On Tue, Apr 4, 2017 at 7:20 AM, Henryk Konsek <hekonsek@xxxxxxxxx> wrote:

Magic "Kapua" class is responsible for holding the obtained token and setting it against HTTP client, so you don't have to do it explicitly.

 

pon., 3 kwi 2017 o 16:47 użytkownik Jens Reimann <jreimann@xxxxxxxxxx> napisał:

That looks great!

How would authentication against Kapua work in this example?

 

On Mon, Apr 3, 2017 at 3:55 PM, Henryk Konsek <hekonsek@xxxxxxxxx> wrote:

Hi,

 

Here is a sample project [1] and example [2] demonstrating how to run our SDK generated from Swagger. Let me know what do you think about it :) .

 

 

wt., 28 mar 2017 o 21:33 użytkownik Henryk Konsek <hekonsek@xxxxxxxxx> napisał:

I've been playing with Swagger client generator. And I have bad and good news :) .

 

Bad news is that the code client generates doesn't work for our API definition. Client can send authentication request, but it cannot parse the response received.

 

Good news is that the generate code doesn't seem to be totally ugly and broken, so I propose that we use Swagger to generate the Java client and fix/improve it to make it work and maybe add some extra wrappers around it to make it more usable.

 

I will play with it and send you link to pull request with my client proposition based on fixed Swagger code.

 

wt., 28 mar 2017 o 15:37 użytkownik Jens Reimann <jreimann@xxxxxxxxxx> napisał:

A Client API casting show, awesome!

 

On Tue, Mar 28, 2017 at 3:34 PM, Henryk Konsek <hekonsek@xxxxxxxxx> wrote:

Yeah, my experiences with Swagger generator is that clients are far from being readable. :(

 

But maybe let's try to generate client in the first place and let's see how nice it is from a developer point of view. Then let's decide which approach (generator vs manually created wrapper) will be the best.

 

Sounds fair?

 

wt., 28 mar 2017 o 15:22 użytkownik Jens Reimann <jreimann@xxxxxxxxxx> napisał:

One candidate could also be OkHttp. I've seen Cedric Brun do amazing things with this programming against the Mattermost API, creating his chat bot.

I have a few doubts that we can simple "generate" the client code though. And in many cases generated code looks ugly and overly complex compared to a well designed API.

So if we can automatically validate the API against the server REST interface, which should be possible during the build, then we should consider defining the Client API ourselves making it easy to understand. And would still catch incompatibilities pretty early. Which is also important as we need to provide some backward compatibility at some point.

 

On Tue, Mar 28, 2017 at 3:11 PM, Morson, Stefano <stefano.morson@xxxxxxxxxxxx> wrote:

Having a SDK to ease the writing of the client code is a good idea.

Client code is about building 3rd party apps on top of Kapua so we should also support multiple bindings to guarantee the highest level of access to the platform. More over, in my experience, not only it requires coding effort but it also needs to be constantly kept aligned with the API. So i think that the code generation approach is the best, 

- reduces the coding effort 

- automatically keeps the SDK aligned with the API

- supports multiple bindings

 

Swagger supports code generation but it is not the only tool, one may want to use 

wadl2java (also used in SOAPUI I guess), maybe there are plugins for IDEs. These will produce full-object wrappers.

 

When developing client code the most boring part of the job is to deal with model objects.

We could support a lightweight client library that uses apache http-components (which is rest framework agnostic) or jersey classes to manage http connections; swagger can then generate the code for model objects in the bindings that we want to support (which initially will be java).

 

So I wouldn't develop an on-purpose library here.

 

Stefano Morson


From: kapua-dev-bounces@xxxxxxxxxxx <kapua-dev-bounces@xxxxxxxxxxx> on behalf of Dejan Bosanac <dejanb@xxxxxxxxxxxx>
Sent: Tuesday, March 28, 2017 9:58:58 AM
To: kapua developer discussions
Subject: Re: [kapua-dev] REST API SDK

 

+1

 

On Tue, Mar 28, 2017 at 9:22 AM, Jens Reimann <jreimann@xxxxxxxxxx> wrote:

I any case, having a "ready-to-run" Kapua Client SDK would be awesome! And having a well-designed API would probably help!

 

On Mon, Mar 27, 2017 at 6:32 PM, Mezzasalma, Claudio <Claudio.Mezzasalma@xxxxxxxxxxxx> wrote:

Swagger itself (not the UI project of course) should be capable of something similar automatically. Have you looked into it?

 

-- 

Claudio Mezzasalma | Eurotech

 

Da: <kapua-dev-bounces@xxxxxxxxxxx> per conto di Henryk Konsek <hekonsek@xxxxxxxxx>
Risposta: kapua developer discussions <kapua-dev@xxxxxxxxxxx>
Data: lunedì 27 marzo 2017 18:12
A: kapua developer discussions <kapua-dev@xxxxxxxxxxx>
Oggetto: [kapua-dev] REST API SDK

 

Hi,

 

What do you think about adding REST API SDK module to Kapua? That would be useful both for testing purposes, as for end users. I'm thinking about creating SDK DSL wrapper around HTTP client similar to something like:

 

KapuaTokenProvider token = new KapuaTokenProvider(""username", "password");

List<User> users = new UserService(token).listUsers();

 

I can start working on such SDK module, as will need it anyway for OpenShift regression testing.

 

What do you think?

 

Cheers!

--

 

_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev




--

Jens Reimann
Senior Software Engineer / EMEA ENG Middleware
Werner-von-Siemens-Ring 14
85630 Grasbrunn
Germany
phone: +49 89 2050 71286
_____________________________________________________________________________

Red Hat GmbH, www.de.redhat.com,
Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Paul Argiry, Charles Cachera, Michael Cunningham, Michael O'Neill


_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev



 

--

Regards
--
Dejan Bosanac
http://sensatic.net/about


_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev




--

Jens Reimann
Senior Software Engineer / EMEA ENG Middleware
Werner-von-Siemens-Ring 14
85630 Grasbrunn
Germany
phone: +49 89 2050 71286
_____________________________________________________________________________

Red Hat GmbH, www.de.redhat.com,
Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Paul Argiry, Charles Cachera, Michael Cunningham, Michael O'Neill

_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev

--


_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev




--

Jens Reimann
Senior Software Engineer / EMEA ENG Middleware
Werner-von-Siemens-Ring 14
85630 Grasbrunn
Germany
phone: +49 89 2050 71286
_____________________________________________________________________________

Red Hat GmbH, www.de.redhat.com,
Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Paul Argiry, Charles Cachera, Michael Cunningham, Michael O'Neill

_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev

--

--


_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev




--

Jens Reimann
Senior Software Engineer / EMEA ENG Middleware
Werner-von-Siemens-Ring 14
85630 Grasbrunn
Germany
phone: +49 89 2050 71286
_____________________________________________________________________________

Red Hat GmbH, www.de.redhat.com,
Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Paul Argiry, Charles Cachera, Michael Cunningham, Michael O'Neill

_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev

--


_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev




--

Jens Reimann
Senior Software Engineer / EMEA ENG Middleware
Werner-von-Siemens-Ring 14
85630 Grasbrunn
Germany
phone: +49 89 2050 71286
_____________________________________________________________________________

Red Hat GmbH, www.de.redhat.com,
Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Paul Argiry, Charles Cachera, Michael Cunningham, Michael O'Neill

_______________________________________________ kapua-dev mailing list kapua-dev@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/kapua-dev

_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev
--

_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev




--
Jens Reimann
Senior Software Engineer / EMEA ENG Middleware
Werner-von-Siemens-Ring 14
85630 Grasbrunn
Germany
phone: +49 89 2050 71286
_____________________________________________________________________________

Red Hat GmbH, www.de.redhat.com,
Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Paul Argiry, Charles Cachera, Michael Cunningham, Michael O'Neill
_______________________________________________
kapua-dev mailing list
kapua-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/kapua-dev
--
Henryk Konsek

Back to the top