RESTful API with Pharo with Gemstones

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

RESTful API with Pharo with Gemstones

sergio_101
I have been a project coming up that I really onlyneed a restful  API on.

The front end will  be first built on a mobile device(iOS )then back on possibly android, with a very stripped down web application.

i would like to use pharo/gemstones as the database.

is there a project out there that allows for such restful API development in pharo land? This would be so fun! 

thanks
Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

Sebastian Heidbrink-2
Am 23.06.2015 um 11:40 schrieb sergio_101:
I have been a project coming up that I really onlyneed a restful  API on.

The front end will  be first built on a mobile device(iOS )then back on possibly android, with a very stripped down web application.

i would like to use pharo/gemstones as the database.

is there a project out there that allows for such restful API development in pharo land? This would be so fun! 

thanks

I am not so sure what you mean exactly but this is my stack.

I use pure Zinc-REST on the Gemstone side and the REST API is described in Swagger-Spec from within Gmestone.
Clients are VBA, Amber and Pharo and they utilize the Swagger API spec to access the server.

Works pretty well and is much more preformant than the intial Pharo MongoDB backend I initially used.

Have a look into http://smalltalkhub.com/#!/~HeSe/Swagger-Spec
There you can find most of the needed Swagger implementation some minor details like type constants are missing.

Once your Gemstoneserver knows how to host his Swagger-Spec you can host it via https://github.com/swagger-api/swagger-ui
This saves a lot of explaning time to client developers.

Sebastian
Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

aglynn42
In the event you need a bit more than the below would buy you (although it sounds like it would be fine) Seaside has a REST add-on ->  http://book.seaside.st/book/advanced/restful

Andrew

From: Pharo-users <[hidden email]> on behalf of Sebastian Heidbrink <[hidden email]>
Reply-To: Any question about pharo is welcome <[hidden email]>
Date: Tuesday, June 23, 2015 at 3:12 PM
To: Any question about pharo is welcome <[hidden email]>
Subject: Re: [Pharo-users] RESTful API with Pharo with Gemstones

Am 23.06.2015 um 11:40 schrieb sergio_101:
I have been a project coming up that I really onlyneed a restful  API on.

The front end will  be first built on a mobile device(iOS )then back on possibly android, with a very stripped down web application.

i would like to use pharo/gemstones as the database.

is there a project out there that allows for such restful API development in pharo land? This would be so fun! 

thanks

I am not so sure what you mean exactly but this is my stack.

I use pure Zinc-REST on the Gemstone side and the REST API is described in Swagger-Spec from within Gmestone.
Clients are VBA, Amber and Pharo and they utilize the Swagger API spec to access the server.

Works pretty well and is much more preformant than the intial Pharo MongoDB backend I initially used.

Have a look into http://smalltalkhub.com/#!/~HeSe/Swagger-Spec
There you can find most of the needed Swagger implementation some minor details like type constants are missing.

Once your Gemstoneserver knows how to host his Swagger-Spec you can host it via https://github.com/swagger-api/swagger-ui
This saves a lot of explaning time to client developers.

Sebastian
Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

Mariano Montone
In reply to this post by Sebastian Heidbrink-2
Just curious. How do you implement authorization/authentication? Is
there OAuth(2) support? Or you just use api token?

Mariano

On 23/06/15 16:12, Sebastian Heidbrink wrote:

> Am 23.06.2015 um 11:40 schrieb sergio_101:
>> I have been a project coming up that I really onlyneed a restful  API on.
>>
>> The front end will  be first built on a mobile device(iOS )then back
>> on possibly android, with a very stripped down web application.
>>
>> i would like to use pharo/gemstones as the database.
>>
>> is there a project out there that allows for such restful API
>> development in pharo land? This would be so fun!
>>
>> thanks
>
> I am not so sure what you mean exactly but this is my stack.
>
> I use pure Zinc-REST on the Gemstone side and the REST API is described
> in Swagger-Spec from within Gmestone.
> Clients are VBA, Amber and Pharo and they utilize the Swagger API spec
> to access the server.
>
> Works pretty well and is much more preformant than the intial Pharo
> MongoDB backend I initially used.
>
> Have a look into http://smalltalkhub.com/#!/~HeSe/Swagger-Spec
> There you can find most of the needed Swagger implementation some minor
> details like type constants are missing.
>
> Once your Gemstoneserver knows how to host his Swagger-Spec you can host
> it via https://github.com/swagger-api/swagger-ui
> This saves a lot of explaning time to client developers.
>
> Sebastian


Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

sergio_101
In reply to this post by Sebastian Heidbrink-2
hey, sebastian.. this looks great! this looks like what i am after.. 

did you run into any problems or limitations using Amber as a front end? I have not tried Amber yet, so this might be the right time to give it a shot.. where did you find zinc-rest? a quick search turns up references to it.. should i be able to just install it via my image?

andrew - i thought about using the seaside rest add on, but seaside seems to be alot of overhead just to run a rest server..

mariano - i am thinking about using api token..



On Tue, Jun 23, 2015 at 3:13 PM Sebastian Heidbrink <[hidden email]> wrote:
Am 23.06.2015 um 11:40 schrieb sergio_101:
I have been a project coming up that I really onlyneed a restful  API on.

The front end will  be first built on a mobile device(iOS )then back on possibly android, with a very stripped down web application.

i would like to use pharo/gemstones as the database.

is there a project out there that allows for such restful API development in pharo land? This would be so fun! 

thanks

I am not so sure what you mean exactly but this is my stack.

I use pure Zinc-REST on the Gemstone side and the REST API is described in Swagger-Spec from within Gmestone.
Clients are VBA, Amber and Pharo and they utilize the Swagger API spec to access the server.

Works pretty well and is much more preformant than the intial Pharo MongoDB backend I initially used.

Have a look into http://smalltalkhub.com/#!/~HeSe/Swagger-Spec
There you can find most of the needed Swagger implementation some minor details like type constants are missing.

Once your Gemstoneserver knows how to host his Swagger-Spec you can host it via https://github.com/swagger-api/swagger-ui
This saves a lot of explaning time to client developers.


Sebastian
Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

jfabry
In reply to this post by sergio_101

You can build a simple REST service on top of the Zinc HTTP server quite easily and quickly, there is even an example in the EnterprisePharo book The book is a work in progress but you can get this text here: https://ci.inria.fr/pharo-contribution/view/Books/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/Zinc-HTTP-Server/Zinc-HTTP-Server.html (see Scripting a REST Web Service with Zinc)

On Jun 23, 2015, at 15:40, sergio_101 <[hidden email]> wrote:

I have been a project coming up that I really onlyneed a restful  API on.

The front end will  be first built on a mobile device(iOS )then back on possibly android, with a very stripped down web application.

i would like to use pharo/gemstones as the database.

is there a project out there that allows for such restful API development in pharo land? This would be so fun! 

thanks



---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD lab  -  Computer Science Department (DCC)  -  University of Chile

Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

Sebastian Heidbrink-2
In reply to this post by sergio_101
Hi Sergio,

Zinc-REST is part of the Zinc repository and a fork for Gemstone can be found here: https://github.com/GsDevKit/zinc/tree/gs_master/repository/Zinc-REST.package
Most part is to implement the code that generates the Swagger specification for your ZnRESTCall subclasses. But it is no vodoo.
It becomes more complexe if you would actually like to use the swagger specification on the server site to do request data validation and error handling,.... I currently use Swagger only for documentation purposes.

Amber limitations? Not really.
It took me some time to figure out how to configure my servers to cope with CORS for the Swagger-UI and my current jsonwebtocken security mechanism is not supported by the SwaggerUI and I had to allow insecure access for the Swagger UI to the Gemstone server.

The Amber Swagger-JS integration works quite nicely.
I did not publish the code on Github because the integration is so tiny. I can send it to you if you like.
Or no,... let me prepare a demo based on the Swagger petshop demo and I will put it online.
Might take a day or two until I find some time.
 
Sebastian




Am 23.06.2015 um 13:05 schrieb sergio_101:
hey, sebastian.. this looks great! this looks like what i am after.. 

did you run into any problems or limitations using Amber as a front end? I have not tried Amber yet, so this might be the right time to give it a shot.. where did you find zinc-rest? a quick search turns up references to it.. should i be able to just install it via my image?

andrew - i thought about using the seaside rest add on, but seaside seems to be alot of overhead just to run a rest server..

mariano - i am thinking about using api token..



On Tue, Jun 23, 2015 at 3:13 PM Sebastian Heidbrink <[hidden email]> wrote:
Am 23.06.2015 um 11:40 schrieb sergio_101:
I have been a project coming up that I really onlyneed a restful  API on.

The front end will  be first built on a mobile device(iOS )then back on possibly android, with a very stripped down web application.

i would like to use pharo/gemstones as the database.

is there a project out there that allows for such restful API development in pharo land? This would be so fun! 

thanks

I am not so sure what you mean exactly but this is my stack.

I use pure Zinc-REST on the Gemstone side and the REST API is described in Swagger-Spec from within Gmestone.
Clients are VBA, Amber and Pharo and they utilize the Swagger API spec to access the server.

Works pretty well and is much more preformant than the intial Pharo MongoDB backend I initially used.

Have a look into http://smalltalkhub.com/#!/~HeSe/Swagger-Spec
There you can find most of the needed Swagger implementation some minor details like type constants are missing.

Once your Gemstoneserver knows how to host his Swagger-Spec you can host it via https://github.com/swagger-api/swagger-ui
This saves a lot of explaning time to client developers.


Sebastian

Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

Sven Van Caekenberghe-2

> On 23 Jun 2015, at 22:55, Sebastian Heidbrink <[hidden email]> wrote:
>
> Hi Sergio,
>
> Zinc-REST is part of the Zinc repository and a fork for Gemstone can be found here: https://github.com/GsDevKit/zinc/tree/gs_master/repository/Zinc-REST.package
> Most part is to implement the code that generates the Swagger specification for your ZnRESTCall subclasses. But it is no vodoo.
> It becomes more complexe if you would actually like to use the swagger specification on the server site to do request data validation and error handling,.... I currently use Swagger only for documentation purposes.
>
> Amber limitations? Not really.
> It took me some time to figure out how to configure my servers to cope with CORS for the Swagger-UI and my current jsonwebtocken security mechanism is not supported by the SwaggerUI and I had to allow insecure access for the Swagger UI to the Gemstone server.
>
> The Amber Swagger-JS integration works quite nicely.
> I did not publish the code on Github because the integration is so tiny. I can send it to you if you like.
> Or no,... let me prepare a demo based on the Swagger petshop demo and I will put it online.
> Might take a day or two until I find some time.

Yes please write something about this, this is interesting for many people.

> Sebastian
>
>
>
>
> Am 23.06.2015 um 13:05 schrieb sergio_101:
>> hey, sebastian.. this looks great! this looks like what i am after..
>>
>> did you run into any problems or limitations using Amber as a front end? I have not tried Amber yet, so this might be the right time to give it a shot.. where did you find zinc-rest? a quick search turns up references to it.. should i be able to           just install it via my image?
>>
>> andrew - i thought about using the seaside rest add on, but seaside seems to be alot of overhead just to run a rest server..
>>
>> mariano - i am thinking about using api token..
>>
>>
>>
>> On Tue, Jun 23, 2015 at 3:13 PM Sebastian Heidbrink <[hidden email]> wrote:
>> Am 23.06.2015 um 11:40 schrieb sergio_101:
>>> I have been a project coming up that I really onlyneed a restful  API on.
>>>
>>> The front end will  be first built on a mobile device(iOS )then back on possibly android, with a very stripped down web application.
>>>
>>> i would like to use pharo/gemstones as the database.
>>>
>>> is there a project out there that allows for such restful API development in pharo land? This would be so fun!
>>>
>>> thanks
>>
>> I am not so sure what you mean exactly but this is my stack.
>>
>> I use pure Zinc-REST on the Gemstone side and the REST API is described in Swagger-Spec from within Gmestone.
>> Clients are VBA, Amber and Pharo and they utilize the Swagger API spec to access the server.
>>
>> Works pretty well and is much more preformant than the intial Pharo MongoDB backend I initially used.
>>
>> Have a look into http://smalltalkhub.com/#!/~HeSe/Swagger-Spec 
>> There you can find most of the needed Swagger implementation some minor details like type constants are missing.
>>
>> Once your Gemstoneserver knows how to host his Swagger-Spec you can host it via https://github.com/swagger-api/swagger-ui
>> This saves a lot of explaning time to client developers.
>>
>>
>> Sebastian
>


Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

marten
In reply to this post by sergio_101
We go a very similiar way as Sebastian - but with our company need NOT
to build a Smalltalk-only system, but also offer support for several
other developers/languages.

We use

* Zinc REST

* Gemstone 3.2.6

We generate code to have:

* Swagger-UI and Swagger-Core support (currently 1.2)

Earlier the swagger stuff was also handled by Gemstone, but now we
create Gemstone-Code to write the Swagger-specs into the server filesystem.

Practically the swagger-core support has been working with C# (we had to
correct/change the template for source code generation).

We see now the need to go to Swagger 2.0, to stay near the development
master stream.

The whole system is working very stable - the only problem I have is a
10 MB limit on the Gemstone socket system - here the Zinc HTTP System
subsystem must be changed to get rid of this problem.


Marten

Am 23.06.2015 um 20:40 schrieb sergio_101:

> I have been a project coming up that I really onlyneed a restful  API on.
>
> The front end will  be first built on a mobile device(iOS )then back on
> possibly android, with a very stripped down web application.
>
> i would like to use pharo/gemstones as the database.
>
> is there a project out there that allows for such restful API
> development in pharo land? This would be so fun!
>
> thanks


--
Marten Feldtmann

Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

Sebastian Heidbrink-2
In reply to this post by Sven Van Caekenberghe-2
Hi Sven,

I put some code on GitHub.
There is no working example yet, but all one needs.

I have to get back into Amber and their current way to integrate
external libs.
As soon as I have that working again I will add a Version 1.2 petstore
example.

https://github.com/HeSe/amber-swaggerJs

Most important part is the SwaggerApi class and the methods build and
initializeSwaggerInterfaceFor:
They import the hosted swagger spec and build the JS-Api Interface
object one can use in Amber,.... there is really not much to it.

Sebastian

Am 23.06.2015 um 14:39 schrieb Sven Van Caekenberghe:

>> On 23 Jun 2015, at 22:55, Sebastian Heidbrink <[hidden email]> wrote:
>>
>> Hi Sergio,
>>
>> Zinc-REST is part of the Zinc repository and a fork for Gemstone can be found here: https://github.com/GsDevKit/zinc/tree/gs_master/repository/Zinc-REST.package
>> Most part is to implement the code that generates the Swagger specification for your ZnRESTCall subclasses. But it is no vodoo.
>> It becomes more complexe if you would actually like to use the swagger specification on the server site to do request data validation and error handling,.... I currently use Swagger only for documentation purposes.
>>
>> Amber limitations? Not really.
>> It took me some time to figure out how to configure my servers to cope with CORS for the Swagger-UI and my current jsonwebtocken security mechanism is not supported by the SwaggerUI and I had to allow insecure access for the Swagger UI to the Gemstone server.
>>
>> The Amber Swagger-JS integration works quite nicely.
>> I did not publish the code on Github because the integration is so tiny. I can send it to you if you like.
>> Or no,... let me prepare a demo based on the Swagger petshop demo and I will put it online.
>> Might take a day or two until I find some time.
> Yes please write something about this, this is interesting for many people.
>
>> Sebastian
>>
>>
>>
>>
>> Am 23.06.2015 um 13:05 schrieb sergio_101:
>>> hey, sebastian.. this looks great! this looks like what i am after..
>>>
>>> did you run into any problems or limitations using Amber as a front end? I have not tried Amber yet, so this might be the right time to give it a shot.. where did you find zinc-rest? a quick search turns up references to it.. should i be able to           just install it via my image?
>>>
>>> andrew - i thought about using the seaside rest add on, but seaside seems to be alot of overhead just to run a rest server..
>>>
>>> mariano - i am thinking about using api token..
>>>
>>>
>>>
>>> On Tue, Jun 23, 2015 at 3:13 PM Sebastian Heidbrink <[hidden email]> wrote:
>>> Am 23.06.2015 um 11:40 schrieb sergio_101:
>>>> I have been a project coming up that I really onlyneed a restful  API on.
>>>>
>>>> The front end will  be first built on a mobile device(iOS )then back on possibly android, with a very stripped down web application.
>>>>
>>>> i would like to use pharo/gemstones as the database.
>>>>
>>>> is there a project out there that allows for such restful API development in pharo land? This would be so fun!
>>>>
>>>> thanks
>>> I am not so sure what you mean exactly but this is my stack.
>>>
>>> I use pure Zinc-REST on the Gemstone side and the REST API is described in Swagger-Spec from within Gmestone.
>>> Clients are VBA, Amber and Pharo and they utilize the Swagger API spec to access the server.
>>>
>>> Works pretty well and is much more preformant than the intial Pharo MongoDB backend I initially used.
>>>
>>> Have a look into http://smalltalkhub.com/#!/~HeSe/Swagger-Spec
>>> There you can find most of the needed Swagger implementation some minor details like type constants are missing.
>>>
>>> Once your Gemstoneserver knows how to host his Swagger-Spec you can host it via https://github.com/swagger-api/swagger-ui
>>> This saves a lot of explaning time to client developers.
>>>
>>>
>>> Sebastian
>
>


Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

Sebastian Heidbrink-2
In reply to this post by marten
Actually with the new version 2.0 I would also change my workflow.
Version 1.2 had not online spec editor tooling support and this is why I
let Gemstone describe my REST API and render the Swagger json specification.

In Swagger 2.0 I would rather take the online spec editor define a
swagger spec and take the resulting json file to generate ZincRESTCall
subclasses.
This way a client developer or user is able to define his or her needs.

Whish I had more time right now.

Sebastian


Am 24.06.2015 um 01:14 schrieb [hidden email]:

> We go a very similiar way as Sebastian - but with our company need NOT
> to build a Smalltalk-only system, but also offer support for several
> other developers/languages.
>
> We use
>
> * Zinc REST
>
> * Gemstone 3.2.6
>
> We generate code to have:
>
> * Swagger-UI and Swagger-Core support (currently 1.2)
>
> Earlier the swagger stuff was also handled by Gemstone, but now we
> create Gemstone-Code to write the Swagger-specs into the server filesystem.
>
> Practically the swagger-core support has been working with C# (we had to
> correct/change the template for source code generation).
>
> We see now the need to go to Swagger 2.0, to stay near the development
> master stream.
>
> The whole system is working very stable - the only problem I have is a
> 10 MB limit on the Gemstone socket system - here the Zinc HTTP System
> subsystem must be changed to get rid of this problem.
>
>
> Marten
>
> Am 23.06.2015 um 20:40 schrieb sergio_101:
>> I have been a project coming up that I really onlyneed a restful  API on.
>>
>> The front end will  be first built on a mobile device(iOS )then back on
>> possibly android, with a very stripped down web application.
>>
>> i would like to use pharo/gemstones as the database.
>>
>> is there a project out there that allows for such restful API
>> development in pharo land? This would be so fun!
>>
>> thanks
>


Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

hernanmd
Sebastian

I wonder if you


2015-06-25 14:51 GMT-03:00 Sebastian Heidbrink <[hidden email]>:
Actually with the new version 2.0 I would also change my workflow.
Version 1.2 had not online spec editor tooling support and this is why I let Gemstone describe my REST API and render the Swagger json specification.

In Swagger 2.0 I would rather take the online spec editor define a swagger spec and take the resulting json file to generate ZincRESTCall subclasses.
This way a client developer or user is able to define his or her needs.

Whish I had more time right now.

Sebastian



Am 24.06.2015 um 01:14 schrieb [hidden email]:
We go a very similiar way as Sebastian - but with our company need NOT
to build a Smalltalk-only system, but also offer support for several
other developers/languages.

We use

* Zinc REST

* Gemstone 3.2.6

We generate code to have:

* Swagger-UI and Swagger-Core support (currently 1.2)

Earlier the swagger stuff was also handled by Gemstone, but now we
create Gemstone-Code to write the Swagger-specs into the server filesystem.

Practically the swagger-core support has been working with C# (we had to
correct/change the template for source code generation).

We see now the need to go to Swagger 2.0, to stay near the development
master stream.

The whole system is working very stable - the only problem I have is a
10 MB limit on the Gemstone socket system - here the Zinc HTTP System
subsystem must be changed to get rid of this problem.


Marten

Am 23.06.2015 um 20:40 schrieb sergio_101:
I have been a project coming up that I really onlyneed a restful  API on.

The front end will  be first built on a mobile device(iOS )then back on
possibly android, with a very stripped down web application.

i would like to use pharo/gemstones as the database.

is there a project out there that allows for such restful API
development in pharo land? This would be so fun!

thanks




Reply | Threaded
Open this post in threaded view
|

Re: RESTful API with Pharo with Gemstones

hernanmd
Sorry bad typing.

I wonder if you have another version than the published in SmalltalkHub (using Swagger-Support-V12-SebastianHeidbrink.1 currently)
If I evaluate:

(SwaggerAPIReaderV12 on: 'http://petstore.swagger.io/v2/swagger.json') readSwaggerAPIListing inspect

Then "apis" Collection I guess are not read, just "info" (a SwaggerAPISpecListingInfo).
Is there something missing?

Cheers,

Hernán



2015-06-28 18:50 GMT-03:00 Hernán Morales Durand <[hidden email]>:
Sebastian

I wonder if you


2015-06-25 14:51 GMT-03:00 Sebastian Heidbrink <[hidden email]>:
Actually with the new version 2.0 I would also change my workflow.
Version 1.2 had not online spec editor tooling support and this is why I let Gemstone describe my REST API and render the Swagger json specification.

In Swagger 2.0 I would rather take the online spec editor define a swagger spec and take the resulting json file to generate ZincRESTCall subclasses.
This way a client developer or user is able to define his or her needs.

Whish I had more time right now.

Sebastian



Am 24.06.2015 um 01:14 schrieb [hidden email]:
We go a very similiar way as Sebastian - but with our company need NOT
to build a Smalltalk-only system, but also offer support for several
other developers/languages.

We use

* Zinc REST

* Gemstone 3.2.6

We generate code to have:

* Swagger-UI and Swagger-Core support (currently 1.2)

Earlier the swagger stuff was also handled by Gemstone, but now we
create Gemstone-Code to write the Swagger-specs into the server filesystem.

Practically the swagger-core support has been working with C# (we had to
correct/change the template for source code generation).

We see now the need to go to Swagger 2.0, to stay near the development
master stream.

The whole system is working very stable - the only problem I have is a
10 MB limit on the Gemstone socket system - here the Zinc HTTP System
subsystem must be changed to get rid of this problem.


Marten

Am 23.06.2015 um 20:40 schrieb sergio_101:
I have been a project coming up that I really onlyneed a restful  API on.

The front end will  be first built on a mobile device(iOS )then back on
possibly android, with a very stripped down web application.

i would like to use pharo/gemstones as the database.

is there a project out there that allows for such restful API
development in pharo land? This would be so fun!

thanks