How to handle API response time and set its answers to custom state - bubble.io

I want to integrate an app with an external API and them make some changes to things with the API answer
The problem that I'm facing is: the API takes time to answer and the custom state where I fill the answers is not storing any data
How can i handle this?
I'm attaching the image showing how I'm trying to store the API answer into the custom state

Related

react-activity-feed: How to over ride the activity update on submit

I'm using the react-activities-feed components to manage the user side of feeds for our web app. The documentation is very lacking and I'm trying to figure out how to customize how the with a callback for making the post. I think it's the doRequest property, but I'm not 100% sure.
EDIT: It IS doRequest and it just expects a promise as a return. However... When I do my own doRequest and just console.log the input it's the activity. Which it great, BUT the images are already uploaded in this activity and have URL's
How do I hijack the image upload process and use my own? I use Google Cloud buckets with signedURL's.

React App Sync Data with REST API After User Actions

Technology Information: ReactJS + Typescript for the frontend. REST API built with nodeJS+express that stores data in a Cloud Firestore database. The frontend React application retrieves data using the REST API.
State Management on the Frontend: I'm currently using React hooks for state management. useContext is used for managing global state (user/session information), and useReducer is used for route level state. The useReducer hook is called by the top level component in any given route.
Advice Requested:
If the user takes an action with the UI, I want to update the local state and show the appropriate changes in the UI instantly. I want to make sure the data gets saved to our backend, and only display an error message if we failed to save the data.
What's the most seamless way of handling data synchronization in this case? What's the best architecture here?
Should I make calls to the REST API from within each action in the
reducer?
What's the cleanest way to implement this throughout a large application? How should I organize my code for data synchronization?
Along the same lines, if I want to listen to changes to the user
object in the backend, and reload the user's information that's
stored in global state using the useContext hook, how should I try
to do this?
P.S. I love how seamlessly Asana syncs & saves your data. I'm wondering what are the best practices here if I want to have that seamless of an experience.

Get Data from Web - 404 error

I am trying to get data from a website into a table in Excel. I am just using the regular button (get data - from web) in Excel (No code) Works fine for two websites but for a different website I am getting the following error:
Details: "The remote server return an HTTP status code '404' when trying to access 'https://smarkets.com/listing/sport/football/premier-league-2017-2018'."
The webpage certainly exists - I am guessing this is a deliberate strategy by the website to prevent data harvesting.
Anyone have any idea how I can get round it either through the get data route or a VBA approach?
Thanks
JL
I inspected traffic with Fiddler and Postman to no avail and in the end contacted the team direct for an answer.
The short answer, from their API team, is no.
Eventually our API, which may be suitable for your needs, will be
available to everyone.
API is in closed alpha stage as I mentioned in comments. More information here: API feed.
API/Odds Feed We're currently working on a new streaming API that is
faster and more scalable. The API is currently in a closed alpha
stage. Unfortunately there is no timeframe on when we'll be able to
release it to the public.
We will prioritise market makers when issuing streaming API accounts.
If you would like to gain alpha access to this service, you can apply
by outlining your proposal here
You can gain access to their XML feed with odds.smarkets.com/oddsfeed.xml .
The feed is updated every few seconds but the information is delayed
by 30 seconds.

Sail.js - how to structure JSON based live data output with existing static data in the model

In my Angular app, I want to display a table which contains the following
a) URL
b) Social share counts divided by different social networks
Using Sails.js, I already have the api created for the URL when the results show up, I can display the URL now I'm confused how to get the appropriate social counts showing right besides
Here's the API I'm using: https://docs.sharedcount.com/
by itself, I can see the JSON it produces
But here are my questions:
Should I create a new api (model/controller) for social count data or include it in my model where I have the 'url' action defined?
If I create a new api or include the social_counts as an action in the current, what would my JSON query look like? to retrieve the URL's, I'm using default API blueprint that Sails provides, so:
http://www.example.com/url/find?where={"title":{"contains":"mark"}}
Struggling a bit in terms of the thought process, would be great to get input on this
It depends on your app. is your app will store that data or just consume it? If it need to store, of course you need the API. In purpose for modification or aggregating the data for example.
No, you can't do that. That shortcut method only works if you have the data in your database and let the Sails Waterline ORM and Blueprint API served it.
Perhaps, if you only need to consume the data from that Sharedcount API, you didn't need to use Sails as a backend, in this context. Just use Angular as a client of that API. Except if you need to modify the data first and store it in your own database, so Sails will helps with it's Waterline ORM and Blueprint API.

Posting Firebases's thirdpartyuserdata object to the server

I'm using Firebase and the SimpleLogin to allow users to login via Google, Twitter etc.
I'd like to use some of the thirdpartyuserdata object to create a user profile for my application which runs on Node.
Currently I'm posting this data to the server so that I can add to it and create the profile object, but I wondered if there's a better way of doing this - is there something I can call server side to get this thirdpartyuserdata without having to post it from the client?
Start by considering that your "server" is actually just another consumer of Firebase data. Since FirebaseSimpleLogin is simply a token generator with some fancy tools for doing OAuth, and because this happens completely client-side, there is nothing to consume about this.
If you want to consume the data at the server, you will either need to POST it, as you have done, or use Firebase to transfer the information. You'll find that a queue approach can save you a large amount of code, as this allows you to use Firebase as the API, and avoid creating RESTful services in Node, and all the baggage that comes with that.
The idea of a queue is simply that you push data into Firebase at one client and read it out (and probably delete it) at the intended recipient (in this case your node worker).

Resources