how to store data on Firebase - Delphi XE 10 - delphi

What is the best way to connect to Google´s Firebase DBaaS from Embarcadero Delphi XE 10 ?
I am not sure how to do it from AnyDAC.
Or if exists a component out there (i coundnt find one on search)
Any help?
thank you

Firebase was acquired by Google and now makes available many tools and features (Cloud Messaging, Authentication, Realtime Database, Storage, Hosting etc...)
If you are looking for a service that store and sync app data in realtime, the Realtime Database it's for you. Realtime Database: "A cloud-hosted NoSQL database. Data is stored as JSON, synced across connected devices in milliseconds, and available when your app goes offline." . Firebase provides SDK library for Android, iOS and Web (Javascript). In addition makes available a REST API interface and, as Robert Love said in previous post, Firebase4Delphi (I wrote it) library provides access to the REST API in Delphi. Here there is an example of how to use library.

In the meantime a new open source library is available on GitHub for Firebase, Firestore, Firebase Storage and Firebase Functions:
Get more information on https://github.com/SchneiderInfosystems/FB4D

There is an open source project called Firebase4Delphi. It provides access to the REST API in Delphi.

Related

Which backend service to use for iOS client, flask vs node.js vs firebase firestore?

This is not a coding query. Rather an starting point query.
I am new to iOS app development. I have been given a project by my university to make two iOS applications. One application will store few information about dustbin, like the dustbin's serial number, its type and its location in the campus. The location are named as zone A or B or C. These locations will contain their respective geographic information. These information will be sent to another iOS app. The second iOS app have the functionality of generating a map and routing the app user to the dustbin location. The map and routing facility is to be provided by HERE APIs (it is a constraint, and I cant be flexible with this). All this information flow will be facilitated by a server in between. Also, there should be a database storage management system.
Now note that, the server is not generating any active information itself. It is acting as a PASSIVE element. Client_1 is sending the message to Client_2, and this message is going through the server. this message is of course stored in a database.
Now I have few questions, or I should say few points that I dont understand and I am stuck at it.
Should I use Flask or node.js or Firebase firestore is sufficient?
If I do need to use firestore with flask or node.js, where shall I implement the firestore framework, on the server side (flask or node.js) or at the client side (iOS) ?
If I have to use the firestore in client side, do I need to implement it on both the client codes?
Given that I have to use firestore with one of the server, which one shall I use? Flask or node.js?
The above are few queries, which will help me get started on iOS app development. (Note that the iOS coding is being done with Swift 5.1)
Thank you all.
Firestore will work only as your database, where you could keep collections and documents, regarding the dustbins. As mentioned in the official Firestore documentation:
Use our flexible, scalable NoSQL cloud database to store and sync data for client- and server-side development.
So, you can actually develop your applications using it on either client or server sides. It would depend more on what you would prefer. Firestore supports Node.js, so, considering that, using Node.js makes more sense than Flask.
You can get a nice tutorial on how to do that, accessing the below article.
Write to cloud Firestore using node.js server
However, it's possible to use Firestore, as very well explained in this article, directly with Swift.
There isn't a "final" or correct answer for your question. For this reason, I would recommend you to take a look at both of them and make the decision based on your knowledge and preferences.
Let me know if the information helped you!

How to update CloudKit public database with data from third-party REST API

I would like to update the public database of CloudKit for a mobile app with data from a third-party REST API. For example, I will start with several records in CloudKit, each of which contains the identifier of a record in the third-party REST API. If possible, I would like to write a script that pulls data from that API on a timed schedule and updates the corresponding CloudKit records.
I see that CloudKit JS is available, but I don't think this is what I need, since I am not trying to do anything with a web app here. I also know that the database can be updated from within an app, and that this is not what I need to do.
I believe the terminology for this is server-side logic. Is there any way I can use server-side logic to update the public database of CloudKit with data from a third-party REST API? I am not asking for the code to do this, but if it can be done using the tools available from CloudKit, and if anyone can point me in the right direction.
EDIT: UPDATE: Seems like maybe I have to run php from my own server to update iCloud database.

Pushing data from iOS to Google Cloud BigQuery

I am new to Google Cloud Platforms and not quite sure with the whole architecture but what I am trying to achieve is to save some data to Google Cloud from an iOS application and do some analytics work on this data using Google Cloud Products, such as: Dataproc and Datalab. From what I read so far I would need to create a dataset in Google Cloud BigQuery and create a table in it. I have done this using the Google Cloud Web UI but now I want to populate the table from my iOS app. I can't seem to find how to do that.
The most painless route would be to wire up Firebase Analytics and then turn on its daily log export to Big Query, as described by Google in the walkthrough Importing Firebase Analytics Data into BigQuery. Google maintains the entire analytic export stack for you then, seeing as they also maintain Firebase. The downside is that the analytics export happens only daily.
Alternatively, you'd be looking at using the Big Query REST API to upload data, as documented by Google in their Loading Data with a POST Request how-to guide. The iOS tooling for that would be your usual NSURLSession and NSURLDataTask APIs, or whatever abstraction you prefer that's built atop them.
Google does maintain a collection of iOS-native APIs, but unfortunately, Big Query is not included amongst the supported APIs as of May 2017. There are native Big Query clients for Go, C#, and Java, amongst others. So you could use your own API for upload to a server you control, and then use one of those client APIs serverside to implement the actual Big Query integration, if you wished.

Can I use Sql Server Database from iOS?

There are a lot of ways to have a database on server ( I can use my own server or I can use MS Azure (for Azure I found REST API Description https://msdn.microsoft.com/en-us/library/azure/gg715283.aspx , but I didn't find a way to add some rows to a table or to get information from the table)), but I want to edit the database and get proper rows from the server database from iOS code without having server API. There are a lot of ready solutions such as Backendless.com , but they are not stable.
So is there any way to connect to the remote SQL server database on the remove server or to MS Azure database and to edit rows and fetch data?
May there are some framework for iOS to do than? (for example in .Net there are Linq framework and Entity Framework).
In your question, you linked to a management API for SQL Database service - this has nothing to do with data manipulation; it's strictly a management API for dealing with servers and databases.
If you want to direct-connect from an IOS app to SQL Database Service (or SQL Server in a VM), you'd need to find a client library for IOS (and recommendations of such a library are not in scope for StackOverflow). There is no native SQL Server client library specifically provided through the Azure SDKs / APIs.
Outside of a native client library, there is Azure Mobile Services, which provides an API stack specifically designed around use by mobile apps (whether IOS, Android, Windows Phone, or even JavaScript). The API stack provided here, by default, gives CRUD operations for SQL Database tables. Additionally, it supports adding custom API calls, where you have complete control of your API calls.
Any other API stack would require you to choose the stack and run it yourself (whether in a Linux or Windows VM, Cloud Service, or Web App - there's no single right way to do this).
Documentation for Azure Mobile Apps (and related API feature, such as monitoring) is here.
Since you are developing in Azure consider automatic REST API from SlashDB, which is available from their Marketplace.
https://azure.microsoft.com/en-us/marketplace/partners/vte/slashdb-slashdb-azure/
SlashDB reflects the entire database as URL-linked structure so a lot of queries need not even be written. It supports SELECT, INSERT and UPDATE. In addition to that it allows for defining an API end-point to call a stored procedure or return results of a SQL query.
Disclosure: I am the founder and CEO of the company behind SlashDB, but you don't have to take my word it - just try it.

Using JS Interop from Dart server

I am trying to create a Dart server that watches a Firebase path. There is a Firebase package in Pub, it is a wrapper for the Javascript library. The instructions for installing the library say:
The firebase.js library MUST be included for the wrapper to work:
I can see how this would work with a client-side Dart application, but how can I use the Firebase Javascript library from a Dart server?
The library you reference (firebase.dart) is purely for client-side usage. For server-side usage, Firebase offers a REST API. There are helper libraries for many languages, but not for Dart as far as I know. As it's REST, it seems to be very easy to interact with Firebase endpoints to get and put data.
You'll want to set up an HttpServer, of course, and then it's a matter of interacting with the Firebase endpoints using http.put and http.read.
Firebase's server-side streaming support via its REST API seems more involved. There doesn't seem to be many Dart folks using Firebase, certainly not the server-side stuff, and so you'll just have to work through getting your server to interact as the docs explain.
(If I get to that point myself, I'll report back and share my code, though all I care to do at the moment on the server is save some data from a Facebook authentication callback URL which my server reads in. Everything else Firebase is on the client side for me.)

Resources