У меня есть модель под названием Bike, я могу вставить, получить, перечислить объект. Но теперь я хочу обновить только цену объекта Bike в движке Google, сохраняя все остальные поля. Так что я прошел метод патча. Я не понимаю, как использовать метод patch в конечной точке приложения Google для обновления только цены.Как использовать метод patch в конечных точках движка google app
Это мой велосипед модель
@Entity
общественного класса велосипед {
@Id
protected Long id;
@Index
protected String imageUrl;
@Index
protected String title;
@Index
protected String price;
@Index
protected String kmpl;
@Index
protected String cc;
@Index
protected String make;
public Bike(){}
public Bike(String s, String s1, String s2,
String s3, String s4,String s5) {
this.title = s;
this.cc = s1;
this.kmpl = s2;
this.price = s3;
this.imageUrl=s4;
this.make=s5;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getKmpl() {
return kmpl;
}
public void setKmpl(String kmpl) {
this.kmpl = kmpl;
}
public String getCc() {
return cc;
}
public void setCc(String cc) {
this.cc = cc;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getMake() {
return make;
}
public void setMake(String make) {
this.make = make;
}
}
это моя вставка апи
/**
* Inserts a new {@code Bike}.
*/
@ApiMethod(
name = "insert",
path = "bike",
httpMethod = ApiMethod.HttpMethod.POST)
public Bike insert(Bike bike) {
// Typically in a RESTful API a POST does not have a known ID (assuming the ID is used in the resource path).
// You should validate that bike.id has not been set. If the ID type is not supported by the
// Objectify ID generator, e.g. long or String, then you should generate the unique ID yourself prior to saving.
//
// If your client provides the ID then you should probably use PUT instead.
ofy().save().entity(bike).now();
logger.info("Created Bike with ID: " + bike.getId());
return ofy().load().entity(bike).now();
}
аналогичным образом я хочу использовать метод патч обновить только цену на байк.