Navigation

    APPDRAG Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular

    REMINDER

    Please be respectful of all AppDragers! Keep it really civil so that we can make the AppDrag community of builders as embracing, positive and inspiring as possible.

    Python data retrieval

    Cloud Backend (Cloud DB, API Builder)
    3
    6
    538
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • vinoth kumar
      vinoth kumar last edited by

      Hi team,

      Im bit struggling with Cloud backend Api for python. I want to know how can i use pyodbc library in api builder to retrieve data from database and return the response.
      Pls guide me?

      1 Reply Last reply Reply Quote 0
      • Wassim
        Wassim last edited by

        Hi,
        As we don't provide a python library for this you have to manually make API calls to AppDrag.

        I suggest you to read the code of our Javascript NPM and reproduce the API calls it make in Python : https://github.com/AppDrag/appdrag-cloudbackend
        The code is here:
        https://github.com/AppDrag/appdrag-cloudbackend/blob/master/index.js

        And what might interest you is the sqlSelect and sqlExecuteRawQuery functions

        If you have any question while integrate it feel free to ask.

        vinoth kumar 1 Reply Last reply Reply Quote 0
        • vinoth kumar
          vinoth kumar @Wassim last edited by

          @wassim ,
          Thanks for your reply.
          I still have some doubts with the usage.
          In my scenario, i have a form with some text boxes and an file attachment. When user clicks submit, i use ajax calls to send a post request to my python application api. From there, i get the url parameters and files, and save it to my destination folder and database. Then, i will do some sql queries and return some json data back to ajax calls.

          I want to replicate same functionality here. I can perform ajax calls to the api with required json data and files. But in the backend, how to get those parameters and files, and save the data. Then how to send back some sql query responses as json back to my ajax calls ?

          Please help me on this. If possible, some snippets will be helpful.

          1 Reply Last reply Reply Quote 0
          • Wassim
            Wassim last edited by

            I highly recommend you to follow AppDrag Academy tutorials (https://academy.appdrag.com/), it's based on NodeJs (so javascript) but it's the same logic as Python so if you just need to translate JS to Python must be affordable if you're ok with Python.

            1 Reply Last reply Reply Quote 0
            • Joseph Benguira
              Joseph Benguira last edited by

              We don't have a library for Python but from Python you can use our REST API (like from any language)

              here is a python example to call cloudbackend to do a SELECT query:

              import requests
              
              url = "https://api.appdrag.com/CloudBackend.aspx'"
              params = {"command" : "CloudDBGetDataset","appID" : "YOUR_APPID_HERE", "APIKey":"YOUR_API_KEY_HERE", "query":"SELECT * FROM YOUR_TABLE LIMIT 10"}
              response = requests.post(url, params)
              
              print(response.text)
              

              You can find all API endpoints and required params here in the source of our NPM package for cloudbackend:
              https://github.com/AppDrag/appdrag-cloudbackend/blob/master/index.js

              vinoth kumar 1 Reply Last reply Reply Quote 0
              • vinoth kumar
                vinoth kumar @Joseph Benguira last edited by

                @Joseph-Benguira said in Python data retrieval:

                https://api.appdrag.com/CloudBackend.aspx

                Thanks team. Will definitely give a try.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post