1 Reply Latest reply on Jun 4, 2013 1:04 PM by Ramesh Reddy

    Auto Generate REST

    devin pinkston Newbie

      This may be a sort of feature request similar to Odata, however I am curious to know what the best route would be for automatically generating a REST based service for tables would be.  What I mean be automatically is perhaps a user just creates a few source models/views, but does not create any virtual procedures to deploy a .war.  Odata requires a primary key/unique key, however what if our source does not contain a PK/UK?  Wondering if there is a clear solution to this or perhaps where the best place to start would be.  Or can we just assign a PK to a physical table through a view in our VDB?

       

      Thank you!

        • 1. Re: Auto Generate REST
          Ramesh Reddy Master

          Devin,

          This may be a sort of feature request similar to Odata,

          They are completely two different features in Teiid. Auto generate REST is custom webservice user defines based on the metadata he/she defines on the procedure. Here how it accessed is defined by user (URL). By default a Teiid does not generate this REST web service for your VDB, it generates *only if* certain metadata exists

           

          OData is spec, here Teiid automatically generates the REST based web service, however the access/query to the service is defined by OData spec.

           

           

          however I am curious to know what the best route would be for automatically generating a REST based service for tables would be. 

          Right now use OData.

           

          What I mean be automatically is perhaps a user just creates a few source models/views, but does not create any virtual procedures to deploy a .war.  Odata requires a primary key/unique key, however what if our source does not contain a PK/UK?  Wondering if there is a clear solution to this or perhaps where the best place to start would be.  Or can we just assign a PK to a physical table through a view in our VDB?

          If you are using the Dynamic VDB, then you can override the direct metadata load from database and define DDL your self, then you can define a PK or UNIQUE on them. Otherwise, you write "Delegating Translator" where this can intercept the metadata call to the database, and update the retrieved metadata with PK and UNIQUE.

           

          if you are using Designer, create a VIEW model that corresponds to one to one transformation of the source, but add in PK or UNIQUE keys on the view table. This is by far simplest.

           

          Hope this helps.

           

          Ramesh..