使用REST Api编辑孩子的属性 [英] Edit property of a child using REST Api
问题描述
我有一个以以下形式上传的数据集:
I have a dataset uploaded in following form:
SomeKey
-> Alphabet
-Emp1: "{ 'Fname' : 'Bob', 'Lname' : 'Sob' }"
-Emp2: "{ 'Fname' : 'Tom', 'Lname' : 'Mot }"
现在使用Rest API,我想将键为 Emp1
的员工的 Fname
和 Lname
编辑为 Fred
和 Dref
,雇员的 Fname
和 Lname
,键为 Emp2
到 Kent
的员工,并且一次通话中 Tenn
.这可能吗?如果是,怎么办?
Now using Rest API, I want to edit Fname
and Lname
of employee with key Emp1
to Fred
and Dref
, and Fname
and Lname
of employee with key Emp2
to Kent
and Tenk
in one single call. Is this possible? If yes, how?
推荐答案
如果您想更新单个员工,则可以通过如下所示的PUT REST API调用来实现:
If you would like to update a single employee, you can do so with a PUT REST API call like this:
curl -X PUT -d <data> https://some.url.com/SomeKey/Employees/Emp1/.json
如果要使用单个REST API调用更新多名员工,则可以使用如下所示的PATCH REST调用来实现:
If would like to update multiple employees using a single REST API call, you can do so with a PATCH REST call like this:
curl -X PUT -d '{"Emp1":<data1>,"Emp2":<data2>"}' \
https://some.url.com/SomeKey/Employees/.json
有关REST API的其他详细信息,请参见: https://www.firebase.com/docs/rest-api.html
Additional details about the REST API are available here: https://www.firebase.com/docs/rest-api.html
这篇关于使用REST Api编辑孩子的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!