get firebase data through cloud functions without any trigger










0















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?










share|improve this question
























  • 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
















0















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?










share|improve this question
























  • 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














0












0








0








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?










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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













2 Answers
2






active

oldest

votes


















2














  1. Define an an HTTP trigger.

  2. Code that trigger to query Realtime Database using the Admin SDK.

  3. Gather the fetched data into some variable, in the format you would like to serialize back to the client.

  4. Send the database back to the client using the provided Response object passed to the trigger.

  5. In the client, invoke that HTTP trigger using the URL it was assigned, and parse the data returned from step 4.





share|improve this answer























  • working like a charm. Thank you!

    – Rakesh Kumar
    Nov 15 '18 at 6:14


















0














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.






share|improve this answer























  • 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










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
);



);













draft saved

draft discarded


















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









2














  1. Define an an HTTP trigger.

  2. Code that trigger to query Realtime Database using the Admin SDK.

  3. Gather the fetched data into some variable, in the format you would like to serialize back to the client.

  4. Send the database back to the client using the provided Response object passed to the trigger.

  5. In the client, invoke that HTTP trigger using the URL it was assigned, and parse the data returned from step 4.





share|improve this answer























  • working like a charm. Thank you!

    – Rakesh Kumar
    Nov 15 '18 at 6:14















2














  1. Define an an HTTP trigger.

  2. Code that trigger to query Realtime Database using the Admin SDK.

  3. Gather the fetched data into some variable, in the format you would like to serialize back to the client.

  4. Send the database back to the client using the provided Response object passed to the trigger.

  5. In the client, invoke that HTTP trigger using the URL it was assigned, and parse the data returned from step 4.





share|improve this answer























  • working like a charm. Thank you!

    – Rakesh Kumar
    Nov 15 '18 at 6:14













2












2








2







  1. Define an an HTTP trigger.

  2. Code that trigger to query Realtime Database using the Admin SDK.

  3. Gather the fetched data into some variable, in the format you would like to serialize back to the client.

  4. Send the database back to the client using the provided Response object passed to the trigger.

  5. In the client, invoke that HTTP trigger using the URL it was assigned, and parse the data returned from step 4.





share|improve this answer













  1. Define an an HTTP trigger.

  2. Code that trigger to query Realtime Database using the Admin SDK.

  3. Gather the fetched data into some variable, in the format you would like to serialize back to the client.

  4. Send the database back to the client using the provided Response object passed to the trigger.

  5. In the client, invoke that HTTP trigger using the URL it was assigned, and parse the data returned from step 4.






share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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













0














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.






share|improve this answer























  • 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















0














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.






share|improve this answer























  • 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













0












0








0







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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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

















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

Evgeni Malkin