1

Searching for ways to build REST APIs, I found skue (https://code.google.com/p/skue/). However there is not much information on the site. My plan is to build a rest api as follows strictly:

Models << Business logics << Restful Resources.

What this means is: the models are access exclusively by the business logic; the restful resources interface is the only layer a client has direct access to. I am specifying all this to avoid people suggesting using the appengine-rest-server.

My question is: has anyone ever successfully used Skue? If so do you have any examples you would not mind sharing? GET and POST would be sufficient, but more is welcomed. If not Skue, are there any frameworks out there that allow building such rest-apis on top of the google-app-engine?

Dan Holevoet
  • 9,175
  • 1
  • 31
  • 47
kasavbere
  • 5,583
  • 9
  • 46
  • 71

2 Answers2

3

I'm the author of Skuë. Skuë means "mouse" in Bribrí which is the language of an indigenous group of people of Costa Rica, my Country.

I know there isn't enough information on the site: (https://code.google.com/p/skue/)

For developers that want to use it on their own projects. I'm sorry for that I just haven't had the time to do a proper documentation since this is just a side project and not my daily work.

However, I'm willing to help you out with ramping up so you will be able to use it. The first thing to notice is the small example that it's part of the source code. Go to the site then click on Source -> Browse and then expand the "app" branch.

The code inside of the "app" folder represents your own API implementation. The package "skue" contains the actual implementation of the library so basically you just create your Python project for Google App Engine and includes the skuë package directly into it.

Now overwrite your main.py file with the content of the downloaded main.py: main.py on Skuë project.

The most important part of that file is where you put your own routes to your resources implementations: Notice here the use of the "ContactResource".

TASK_HANDLERS = [

                ]

API_HANDLERS = [
                   ('/contacts/(.*)', ContactResource)
               ]

API_DOC = [ ('/', ApiDocumentationResource) ]

Browse to the contact resource implementation.

There are a lot of things going on under the hood there.. but the idea is for you to not worry about those.

You need to inherit from the proper Resource parent class depending on the kind of resource you want to create, there are four basic types:

DocumentResource: A document resource is a singular concept that is akin to an object instance or database record.

CollectionResource: A collection resource is a server-managed directory of resources. Clients may propose new resources to be added to a collection. However, it is up to the collection to choose to create a new resource, or not.

StoreResource: A store is a client-managed resource repository. A store resource lets an API client put resources in, get them back out, and decide when to delete them.

ControllerResource: A controller resource models a procedural concept. Controller resources are like exe- cutable functions, with parameters and return values; inputs and outputs.

Like a traditional web application’s use of HTML forms, a REST API relies on controller resources to perform application-specific actions that cannot be logically mapped to one of the standard methods (create, retrieve, update, and delete, also known as CRUD).

Now take a look at the "describe_resource" implementation on ContactResource example. When you inherit from the basic resource types described above the next step is to programmatically describe your resource to the outside world using that method. The underlying Skuë implementation uses that method to validate require parameters and also to self describe the endpoints when you perform an OPTIONS request on them.

And the final step is for you to implement the methods (CRUD) that you want to handle for your resource.

Again with the ContactResource example, that resource handles the creation, update and read of Contact items.

I hope this helps you at least to understand how to start using the library. I will create better tutorials in the future, though.

In the meantime you can contact me via email: greivin.lopez@gmail.com and I will send you a more elaborated example or even something that matches your requirements.

Important Note: Currently the Skuë project only supports responses in JSON format. If you plan to use another format you will need to create the proper classes to handle it.

Greetings from Costa Rica.

Greivin López
  • 111
  • 1
  • 5
  • Hi Grevin, I've made ``pyramid_skue`` - a library based on Skue for building REST API on top of Pyramid framework. Can you please contact me? https://github.com/kipanshi/pyramid_skue – Kee Nov 22 '13 at 11:28
  • Hi Cyril, I don't really know how to contact you. Feel free to send me an email to greivin.lopez@gmail.com. I saw your code and looks interesting. I don't maintain the Sküe project anymore, the latest version I just moved it to BitBucket: https://bitbucket.org/greivin_lopez/skue. There are a couple of changes from the version you used. I'm glad you found it useful, feel free to continue your work as long as you maintain my file header on the proper files there is not problem with that. – Greivin López Dec 04 '13 at 22:36
1

I haven't used skue, but what you're looking for sounds like a good fit for Google Cloud Endpoints. See my previous answers on the subject for more details.

Community
  • 1
  • 1
Dan Holevoet
  • 9,175
  • 1
  • 31
  • 47
  • Thanks for understanding my dilemma. Your link looks very promising. I am reading up on it right now. (up vote). – kasavbere Nov 26 '12 at 18:40
  • `Google Cloud Endpoint` (`GCE`) is definitely owesome! But there are a few problems: 1) Google is dissuading against using `GCE` in production at this time, which clearly is a big problem. 2) All the examples I was able to find so far pertain to `Java`; there is nothing on `Python` except a blank statement that it can be used with `Python`. So... Do you know where I can find some `Python` examples? Or do I have to apply for `trusted tester` first? Thanks! – kasavbere Nov 26 '12 at 22:58
  • Our only public materials about Endpoints are from I/O, and those all use Java. TTs have access to Python samples as well. Regarding use in production, this is a general statement we give to everyone, but some developers (with Google's blessing) have launched projects using Endpoints. – Dan Holevoet Nov 26 '12 at 23:02
  • One more question: besides the ~ 2-weeks waiting queue, is there a way to speed up getting TT access? Such as attending meetup at Google HQ (e.g. GTUG)? Also, do you mind posting a sample `Python` example here just to help the rest of us get started immediately? Two weeks is a very long time for development. – kasavbere Nov 26 '12 at 23:20
  • Sign up on the TT form and mention Stack Overflow and your username, and I can whitelist you. (Replying to this comment when you've done it would be good, too.) – Dan Holevoet Nov 27 '12 at 02:34