İçeriğe geç

Bireysel Kayıtları Değiştirme

8base’in otomatik olarak oluşturulan GraphQL mutasyon işlemlerini kullanarak bireysel tablo kayıtlarını oluşturabilir, güncelleyebilir ve silebilirsiniz.

Aşağıdaki örneklerde, firstName, email, age gibi alanları ve ilişkileri içeren students adlı bir tablomuz var.

Kayıt verilerini tanımlayan girdi argümanını kullanarak yeni bir kayıt oluşturun.

İstek

mutation MyMutation1 {
createStudents(
input: {
firstName: "John",
lastName: "Doe",
email: "john.doe@example.com",
age: 24,
city: "2900562f-d036-486d-be98-9ebf064c27fe"
}
) {
id
firstName
lastName
email
age
city {
id
nameCity
}
}
}

Yanıt

{
"data": {
"createStudents": {
"id": "2685ec12-a4c7-491d-a155-d0b09190993b",
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"age": 24,
"city": {
"id": "2900562f-d036-486d-be98-9ebf064c27fe",
"nameCity": "Houston"
}
}
}
}

id ve input argümanlarını kullanarak bir kaydı güncelleyin.

İstek

mutation MyMutation1 {
updateStudents(
id: "2685ec12-a4c7-491d-a155-d0b09190993b",
input: {
age: 23
}
) {
id
firstName
age
}
}

Yanıt

{
"data": {
"updateStudents": {
"id": "2685ec12-a4c7-491d-a155-d0b09190993b",
"firstName": "John",
"age": 23
}
}
}

id argümanını kullanarak bir kaydı silin.

İstek

mutation MyMutation1 {
deleteStudents(
id: "2685ec12-a4c7-491d-a155-d0b09190993b"
)
}

Yanıt

{
"data": {
"deleteStudents": true
}
}