get firebase data through cloud functions without any trigger
can I use cloud function to get data from a specific firebase database node?
if there is a node (Car) with child (price) having value ($1000). how can I get this car value by cloud function? I have searched a lot but only able to find functions which work on triggers like onCreate, onUpdate, etc. But how to just simply fetch data without any trigger?
firebase firebase-realtime-database google-cloud-functions
add a comment |
can I use cloud function to get data from a specific firebase database node?
if there is a node (Car) with child (price) having value ($1000). how can I get this car value by cloud function? I have searched a lot but only able to find functions which work on triggers like onCreate, onUpdate, etc. But how to just simply fetch data without any trigger?
firebase firebase-realtime-database google-cloud-functions
You can create basic function that receives get requests and returns cars. ex:yourfrebaseip/cars
. Link: firebase.google.com/docs/functions/http-events
– Omurbek Kadyrbekov
Nov 15 '18 at 5:45
add a comment |
can I use cloud function to get data from a specific firebase database node?
if there is a node (Car) with child (price) having value ($1000). how can I get this car value by cloud function? I have searched a lot but only able to find functions which work on triggers like onCreate, onUpdate, etc. But how to just simply fetch data without any trigger?
firebase firebase-realtime-database google-cloud-functions
can I use cloud function to get data from a specific firebase database node?
if there is a node (Car) with child (price) having value ($1000). how can I get this car value by cloud function? I have searched a lot but only able to find functions which work on triggers like onCreate, onUpdate, etc. But how to just simply fetch data without any trigger?
firebase firebase-realtime-database google-cloud-functions
firebase firebase-realtime-database google-cloud-functions
edited Nov 15 '18 at 5:49
Doug Stevenson
77.2k990111
77.2k990111
asked Nov 15 '18 at 5:36
Rakesh KumarRakesh Kumar
216
216
You can create basic function that receives get requests and returns cars. ex:yourfrebaseip/cars
. Link: firebase.google.com/docs/functions/http-events
– Omurbek Kadyrbekov
Nov 15 '18 at 5:45
add a comment |
You can create basic function that receives get requests and returns cars. ex:yourfrebaseip/cars
. Link: firebase.google.com/docs/functions/http-events
– Omurbek Kadyrbekov
Nov 15 '18 at 5:45
You can create basic function that receives get requests and returns cars. ex:
yourfrebaseip/cars
. Link: firebase.google.com/docs/functions/http-events– Omurbek Kadyrbekov
Nov 15 '18 at 5:45
You can create basic function that receives get requests and returns cars. ex:
yourfrebaseip/cars
. Link: firebase.google.com/docs/functions/http-events– Omurbek Kadyrbekov
Nov 15 '18 at 5:45
add a comment |
2 Answers
2
active
oldest
votes
- Define an an HTTP trigger.
- Code that trigger to query Realtime Database using the Admin SDK.
- Gather the fetched data into some variable, in the format you would like to serialize back to the client.
- Send the database back to the client using the provided Response object passed to the trigger.
- In the client, invoke that HTTP trigger using the URL it was assigned, and parse the data returned from step 4.
working like a charm. Thank you!
– Rakesh Kumar
Nov 15 '18 at 6:14
add a comment |
You need initial the firebase first
// Set the configuration for your app
// TODO: Replace with your project's config object
var config =
apiKey: "apiKey",
authDomain: "projectId.firebaseapp.com",
databaseURL: "https://databaseName.firebaseio.com",
storageBucket: "bucket.appspot.com"
;
firebase.initializeApp(config);
// Get a reference to the database service
var database = firebase.database();
and then read the data:
var carRef = database().ref('Car/);
carRef.on('price', function(snapshot)
console.log(snapshot.val());
);
more information, please check the firebase official document.
Yes exactly what Doug Stevenson had suggested. Anyway, thank you for your response.
– Rakesh Kumar
Nov 15 '18 at 6:18
Now just wondering how to fetch this data in android though this generated url? is it returning data in json format?
– Rakesh Kumar
Nov 15 '18 at 6:32
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53313058%2fget-firebase-data-through-cloud-functions-without-any-trigger%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
- Define an an HTTP trigger.
- Code that trigger to query Realtime Database using the Admin SDK.
- Gather the fetched data into some variable, in the format you would like to serialize back to the client.
- Send the database back to the client using the provided Response object passed to the trigger.
- In the client, invoke that HTTP trigger using the URL it was assigned, and parse the data returned from step 4.
working like a charm. Thank you!
– Rakesh Kumar
Nov 15 '18 at 6:14
add a comment |
- Define an an HTTP trigger.
- Code that trigger to query Realtime Database using the Admin SDK.
- Gather the fetched data into some variable, in the format you would like to serialize back to the client.
- Send the database back to the client using the provided Response object passed to the trigger.
- In the client, invoke that HTTP trigger using the URL it was assigned, and parse the data returned from step 4.
working like a charm. Thank you!
– Rakesh Kumar
Nov 15 '18 at 6:14
add a comment |
- Define an an HTTP trigger.
- Code that trigger to query Realtime Database using the Admin SDK.
- Gather the fetched data into some variable, in the format you would like to serialize back to the client.
- Send the database back to the client using the provided Response object passed to the trigger.
- In the client, invoke that HTTP trigger using the URL it was assigned, and parse the data returned from step 4.
- Define an an HTTP trigger.
- Code that trigger to query Realtime Database using the Admin SDK.
- Gather the fetched data into some variable, in the format you would like to serialize back to the client.
- Send the database back to the client using the provided Response object passed to the trigger.
- In the client, invoke that HTTP trigger using the URL it was assigned, and parse the data returned from step 4.
answered Nov 15 '18 at 5:54
Doug StevensonDoug Stevenson
77.2k990111
77.2k990111
working like a charm. Thank you!
– Rakesh Kumar
Nov 15 '18 at 6:14
add a comment |
working like a charm. Thank you!
– Rakesh Kumar
Nov 15 '18 at 6:14
working like a charm. Thank you!
– Rakesh Kumar
Nov 15 '18 at 6:14
working like a charm. Thank you!
– Rakesh Kumar
Nov 15 '18 at 6:14
add a comment |
You need initial the firebase first
// Set the configuration for your app
// TODO: Replace with your project's config object
var config =
apiKey: "apiKey",
authDomain: "projectId.firebaseapp.com",
databaseURL: "https://databaseName.firebaseio.com",
storageBucket: "bucket.appspot.com"
;
firebase.initializeApp(config);
// Get a reference to the database service
var database = firebase.database();
and then read the data:
var carRef = database().ref('Car/);
carRef.on('price', function(snapshot)
console.log(snapshot.val());
);
more information, please check the firebase official document.
Yes exactly what Doug Stevenson had suggested. Anyway, thank you for your response.
– Rakesh Kumar
Nov 15 '18 at 6:18
Now just wondering how to fetch this data in android though this generated url? is it returning data in json format?
– Rakesh Kumar
Nov 15 '18 at 6:32
add a comment |
You need initial the firebase first
// Set the configuration for your app
// TODO: Replace with your project's config object
var config =
apiKey: "apiKey",
authDomain: "projectId.firebaseapp.com",
databaseURL: "https://databaseName.firebaseio.com",
storageBucket: "bucket.appspot.com"
;
firebase.initializeApp(config);
// Get a reference to the database service
var database = firebase.database();
and then read the data:
var carRef = database().ref('Car/);
carRef.on('price', function(snapshot)
console.log(snapshot.val());
);
more information, please check the firebase official document.
Yes exactly what Doug Stevenson had suggested. Anyway, thank you for your response.
– Rakesh Kumar
Nov 15 '18 at 6:18
Now just wondering how to fetch this data in android though this generated url? is it returning data in json format?
– Rakesh Kumar
Nov 15 '18 at 6:32
add a comment |
You need initial the firebase first
// Set the configuration for your app
// TODO: Replace with your project's config object
var config =
apiKey: "apiKey",
authDomain: "projectId.firebaseapp.com",
databaseURL: "https://databaseName.firebaseio.com",
storageBucket: "bucket.appspot.com"
;
firebase.initializeApp(config);
// Get a reference to the database service
var database = firebase.database();
and then read the data:
var carRef = database().ref('Car/);
carRef.on('price', function(snapshot)
console.log(snapshot.val());
);
more information, please check the firebase official document.
You need initial the firebase first
// Set the configuration for your app
// TODO: Replace with your project's config object
var config =
apiKey: "apiKey",
authDomain: "projectId.firebaseapp.com",
databaseURL: "https://databaseName.firebaseio.com",
storageBucket: "bucket.appspot.com"
;
firebase.initializeApp(config);
// Get a reference to the database service
var database = firebase.database();
and then read the data:
var carRef = database().ref('Car/);
carRef.on('price', function(snapshot)
console.log(snapshot.val());
);
more information, please check the firebase official document.
answered Nov 15 '18 at 6:00
saulsaul
805513
805513
Yes exactly what Doug Stevenson had suggested. Anyway, thank you for your response.
– Rakesh Kumar
Nov 15 '18 at 6:18
Now just wondering how to fetch this data in android though this generated url? is it returning data in json format?
– Rakesh Kumar
Nov 15 '18 at 6:32
add a comment |
Yes exactly what Doug Stevenson had suggested. Anyway, thank you for your response.
– Rakesh Kumar
Nov 15 '18 at 6:18
Now just wondering how to fetch this data in android though this generated url? is it returning data in json format?
– Rakesh Kumar
Nov 15 '18 at 6:32
Yes exactly what Doug Stevenson had suggested. Anyway, thank you for your response.
– Rakesh Kumar
Nov 15 '18 at 6:18
Yes exactly what Doug Stevenson had suggested. Anyway, thank you for your response.
– Rakesh Kumar
Nov 15 '18 at 6:18
Now just wondering how to fetch this data in android though this generated url? is it returning data in json format?
– Rakesh Kumar
Nov 15 '18 at 6:32
Now just wondering how to fetch this data in android though this generated url? is it returning data in json format?
– Rakesh Kumar
Nov 15 '18 at 6:32
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53313058%2fget-firebase-data-through-cloud-functions-without-any-trigger%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can create basic function that receives get requests and returns cars. ex:
yourfrebaseip/cars
. Link: firebase.google.com/docs/functions/http-events– Omurbek Kadyrbekov
Nov 15 '18 at 5:45