Reads from Firestore using a Workflows connector.
Code sample
YAML
What's next
To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser .
Reads from Firestore using a Workflows connector.
-
initialize
:
assign
:
-
project
:
"myproject123"
-
collection
:
"myEntries"
-
document
:
"Report"
-
read_item
:
try
:
call
:
http.get
args
:
url
:
${"https://firestore.googleapis.com/v1/projects/"+project+"/databases/(default)/documents/"+collection+"/"+document}
auth
:
type
:
OAuth2
result
:
document_value
except
:
as
:
e
steps
:
-
is_the_key_found
:
switch
:
-
condition
:
${e.code == 404}
next
:
document_not_found
-
condition
:
${e.code == 403}
next
:
auth_error
next
:
document_found
-
document_not_found
:
return
:
"Document
not
found."
-
auth_error
:
return
:
"Authentication
error."
-
document_found
:
return
:
${document_value.body.fields.LastName.stringValue}
To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser .
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.