3 Replies Latest reply on Sep 19, 2018 1:57 PM by srinath0533

    Consume Rest API through Rest webservice and deploy VDB to Rest API

    srinath0533

      Hello All, I'm trying to consume data through REST API and deploy the VDB to REST API for end users. I have created invokeHttp which is the source model for a Rest API.  Now i would like to deploy this invokeHttp to Rest API. Please help me if i have to create a rest procedure on the top of invokeHttp or how can i deploy this to Rest API web access for end users. I tried creating Rest Proc on the top of invokeHttp but i couldn't Thanks & Regards, Srinath.

        • 1. Re: Consume Rest API through Rest webservice and deploy VDB to Rest API
          srinath0533

          Any help is very much appreciated please. Thank you.

          • 2. Re: Consume Rest API through Rest webservice and deploy VDB to Rest API
            ecabrerar

            Hi,

             

            We need more information about your issue, maybe you can post a code snippet or your project.

             

            Best Regards

            • 3. Re: Consume Rest API through Rest webservice and deploy VDB to Rest API
              srinath0533

              Hello Eudris,

               

              For example if I’m loading the below json data into elastic search index and exposing the index to Rest API, the output look like the URL (https://reqres.in/api/users?page=2)

               

              {
                 "username" : "my_username",
                 "password" : "my_password",
                 "validation-factors" : {
                    "validationFactors" : [
                       {
                          "name" : "remote_address",
                          "value" : "127.0.0.1"
                       }
                    ]
                 }
              }

               

              Once we load the above json and expose to Elastic Search to Rest API the output will look like below. To show you an example I saved the file on my desktop and open in browser. However when I open the original Rest API output will be same as below.

               

              Now I would like to consume a URL like above and expose it through DV layer as is. So I will import the above URL from import>Teiid Importer>Rest and create a InvokeHttp which is the source model.

               

               

              Now I would like to know how can I expose this source model(Invoke HTTP) to Rest API through DV. The reason we want to expose the URL through DV is custom security. Earlier i created a table in viewmodel on top of source model and a Rest Proc on top of table and deployed the VDB for rest access but we could not access as Rest URL as the json file has multiple nested loops and transformation SQL between table and Rest Proc in viewmodel did not support multiple nested loops.  Please let me know if there is a way i can expose the source Rest API as is without creating table and rest procs.

               

              Thanks & regards,

              Srinath