how to connect api.ai bot to a mysql database [closed] - mysql

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm developing an API.AI chat bot to integrate with a website. This also should be able to query from a MySQL database.
What is the approach to implement this?

You should look at Api.ai's fulfillment documentation. Api.ai uses fulfillment webhooks, a URL you define, and then any intent you indicate should use the webhook will send a HTTP request to the webhook with all the relevant information about the user's query (any parameters, the intent, etc.). You can then connect your fulfillment webhook to the database of your choice and map users queries to SQL queries, get the desired information and return it in a response to the user.
Please keep in mind that Api.ai HTTP requests timeout after 5 seconds, which means from the time Api.ai issues a request to the time that you send back a response must be less than 5 seconds.

Related

Can I use POST instead of PUT in a NodeJS app? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 25 days ago.
The community reviewed whether to reopen this question 25 days ago and left it closed:
Original close reason(s) were not resolved
Improve this question
What is the difference if I always use POST method to update a row in the MySQL or Cassandra database instead of PUT?
I ask this because when I did research on that I read in some other questions that were saying POST request causes multiple instances creation. I wanted to make sure if is that correct?
The database doesn't care about how the server talks to clients.
Technically you could use POST for everything. That's basically how GraphQL works. But doing that means your API is not RESTful.
These are the basic RESTful API methods:
Method
Description
GET
Retrieve information about the REST API resource
POST
Create a REST API resource
PUT
Update a REST API resource
DELETE
Delete a REST API resource or related component
That being said, if you feel like your use-case works and reads better with just POST or GET, go for it.
Neither mysql nor Cassandra will even be aware if the client made a http put or post request, so from a database point of view it is totally irrelevant which http request type you use.

How does my web app get real-time notifications of MySQL database changes [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 13 days ago.
This post was edited and submitted for review 12 days ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I have a full stack app that uses React, Node.js, Express, and MySQL. I want the react app to respond to database updates similar to Firebase: When data changes, I want a real-time notification sent to my app.
I want to use stock MySQL (no plugins), so that I can use AWS RDB or whatever.
I will use socket.io to push the real-time notifications to the web app.
To avoid off-target responses, I'll summarize various approaches that are not what I am looking for:
The server could poll, or each client could poll. (Not real-time, but included for completeness. When I search, polling is the only solution I find.)
Write a wrapper that handles all MySQL updates, handles subscriptions, and sends the notifications. This is a complicated component that adds complexity. Firebase is popular because it both increases performance and reduces complexity. I like Firebase a lot but want to do the same thing with MySQL.
Use Firebase to handle the real-time notifications. The MySQL wrapper could use Firebase to handle the subscriptions and notifications, but there is still the problem of triggering the notifications in the first place. Also, I don't want to use Firebase. (For example, my application needs to run in an air-gapped environment.)
The question: Using a stock MySQL database, when a table changes, can a notification server discover the change in real-time (no polling), so that it can send notifications?
To clarify: by "stock MySQL", I mean no plugins, no need for C compilers, and even no need for root access.

How does Google give so fast suggestions? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
So I was debugging the google search using chrome dev tools and I found out that each time I modify the contents of the search bar, it makes a network call. That itself was baffling for me because this means each search generates around 10 or more server calls for google! Even more surprising is the fact that even then google manages to return suggestions so fast. How do they do it?
One more doubt would be how they handle concurrent ajax calls? (assuming they are ajax calls ofcourse). Like if my search does 10 ajax calls to the server and the latest ajax call returns results faster than the second last ajax call then in that case the response from the second last ajax call would be shown on the UI instead of the latest call right?
They have servers that can upload/download and retrieve upwards of 10 GB/s so that is why!
Happy Coding!

iOS - Download json swift [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Good day.
I was faced with the task, can not find the answers on the internet, can anyone be able to help.
I need to send a request to the service. This request must be sent no more than 1 second once per hour. From the answer to the query to extract part of the data. When you receive or availability of this information, it should be added to the text box. Data should be stored and re-used after restarting the application.
To connect to the service, I use Alamofire. Help please, whether there is in this library any function to set the time limit, I request? And how to save the data? Save the new json file locally, or the data stored in an array, or use the database?
Thank you for your help.
I don't have an idea of setting a time limit, but you can explore the NSTimer function to check for that and if it is just a string that you want to store, you only need to use NSUserDefaults for that. It stores your data as a property list and you can access it from anywhere in the app at anytime.
Here's a link to help you setup NSUserDefaults.

Django Celery One request splitting in multiple tasks [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am looking to achieve something like this:
To have one input json request, which will encapsulate what to do than:
split that input into 3 or more sub-requests depending on json, like put in database
an agent will wake up since he is processing one part of that request, like putting data to some server
another agent will woke up since the request is for him too, he will like upload data to some other server
meanwhile another request could do state information about request whats part did executed and finished
Is Django + Celery good for this ?
Main goal is to with one request serve parts independently, so like when processing request when waiting for the server in one part of request will not ommiting other part of request which will be processed without any lag.
If your json contains all sub-requests and can be handled asynchronously, seems like this is a job for RxJava which can handle event based programs using observable sequences. Best to read the docs first to see if they fit your use case.