Deep save issue

Hello,
I’m triying to implement deep-save for my requests. In the documentation, it’s always mentionned to use the PUT to make the request (new or update).
But it didn’t work with PUT. It tell me, for a new save to didn’t have the objectId field. So, I have removed it, but it didn’t work. So I try with the POST and it put me this error message:

I’m lost, I don’t know how to use it in my code. What is the way to do for new creation and update? Any changes about the documentation?

Thanks you

Hi @Indevers ,

Documentation states correctly that you need to use PUT for deep save.
Could you please provide a sample of your request body which caused error for PUT request?

Regards, Andriy

Hello,
I tried three thing. with each time this error message

{
  "code": 1321,
  "message": "Deep save exception. The 'UPDATE' operation payload must contain the 'objectId' property with a valid column name.",
  "errorData": {}
}

The first request payload (an empty objectId)

The second request payload (a null objectId)

The third request payload (without the objectId)

@Indevers ,

Server returns an error since you pass objectId with empty string for linkedMainClient nested object.
For “deep save” to work properly you should specify objectId field only for objects which were created in database before. null or empty string are not valid values and will cause exception.

In “deep save” server relies on presence of objectId field to decide which operation, create or update, it should apply for an object.

Try to remove redundant objectId fields from all your nested objects and execute “deep save” operation one more time.

Regards, Andriy

Ok I just remove all object Id for nested objects when I want to create them. This is my cURL.

curl 'myApp/deep-save' \
-X PUT \
-H 'user-token: myToken' \
-H 'Accept: application/json' \
-H 'Accept-Charset: UTF-8' \
-H 'User-Agent: Ktor client' \
-H 'Host: myApp' \
-H 'Connection: Keep-Alive' \
-H 'Content-Type: application/json' \
--data-raw '{
    "id": 0,
    "orderDate": "06/14/2024 13:02:49",
    "eventDate": "06/06/2024 02:00:00",
    "amount": 0.0,
    "feeAmount": 0.0,
    "hasInsurance": false,
    "hasLitige": false,
    "isPaid": false,
    "isPaymentSent": false,
    "isMoneyTransfered": false,
    "linkedClientId": 12,
    "linkedMainClient": {
        "userId": 12,
        "address": "",
        "location": {
            "coordinates": [
                0.0,
                0.0
            ],
            "type": "Point"
        },
        "email": "",
        "firstname": "",
        "lastname": "",
        "phoneNumber": "",
        "phoneCode": "",
        "profileImage": "",
        "user-token": "",
        "stripeCustomerId": ""
    },
    "linkedSecondaryClient": null,
    "linkedEventId": 41,
    "linkedEvent": {
        "name": "Anniversaire de Yann",
        "id": 41,
        "location": {
            "coordinates": [
                5.899760499999999,
                49.522108
            ],
            "type": "Point"
        },
        "isRecurrentEvent": false,
        "linkedClientId": 12,
        "linkedClient": null,
        "needsList": "3",
        "places": [
            {
                "id": 30,
                "startDatePlace": "06/06/2024 02:00:00",
                "endDatePlace": "06/06/2024 02:00:00",
                "startHour": "15:00",
                "endHour": "17:00",
                "eventType": 4,
                "hasSono": false,
                "hasSoundEngineer": false,
                "numberGuests": 1,
                "address": "115 Rue Emile Mark, Oberkorn Differdange, Luxembourg",
                "location": {
                    "coordinates": [
                        5.899760499999999,
                        49.522108
                    ],
                    "type": "Point"
                },
                "placeName": "",
                "musicStylesList": "5",
                "onSiteEquipmentList": "1",
                "songsRangeNumber": 1
            }
        ],
        "smsNotification": false,
        "emailNotification": false,
        "status": 1,
        "hostelTakenInCharge": false,
        "earlyArrival": false,
        "foodTakenInCharge": false,
        "numberRepetitions": 0,
        "requiredLevel": 0,
        "playClicker": false,
        "visibleInProviderSearch": true,
        "coorganizer": null,
        "linkedCoorganizer": null
    },
    "linkedProviderId": 36,
    "linkedProvider": {
        "id": 36,
        "isSolo": false,
        "bandStyle": [
        ],
        "address": "138 Rue Victor Hugo, Esch-sur-Alzette, Luxembourg",
        "averageRate": null,
        "location": {
            "coordinates": [
                5.97430927,
                49.49620278
            ],
            "type": "Point"
        },
        "description": "Nous sommes le groupe de louange de l'\''église la Source à Esch au Luxembourg.",
        "providerType": 1,
        "emailAddress": "alexandra.gnimadi@gmail.com",
        "eventTypeList": "2",
        "hasOwnSoundEngineer": false,
        "linkedOwnerClientId": 12,
        "medias": [
        ],
        "members": [
        ],
        "movingAroundKm": 50,
        "name": "Worship la Source",
        "numberMembers": 1,
        "phoneNumber": "661760160",
        "phoneCode": "+352",
        "countryCode": "LU",
        "instrumentList": "",
        "pricing": [
        ],
        "unavalaibleDates": [
        ],
        "profileImage": "",
        "sonoInfos": null,
        "playClicker": false,
        "profileStatus": 1
    },
    "isFeesFilled": true,
    "isClientNeedReworkFees": false,
    "step": 2
}' \
--proxy http://localhost:9090

But I have this message now

{
  "code": 1321,
  "message": "Deep save exception. Property 'password' is required",
  "errorData": {}
}

Hello @Indevers,

in your payload you have a link to the user:

 "linkedMainClient": {
        "userId": 12,
        "address": "",
        "location": {
            "coordinates": [
                0.0,
                0.0
            ],
            "type": "Point"
        },
        "email": "",
        "firstname": "",
        "lastname": "",
        "phoneNumber": "",
        "phoneCode": "",
        "profileImage": "",
        "user-token": "",
        "stripeCustomerId": ""
    },

And since the user does not have an objectId, server will consider you’re trying to create a new user, but new user should have a password.

Ok thanks you, now it seems work for the part with objectId or not objectId. But I have this error

{
  "code": 1320,
  "message": "Action requires more operations in transaction than currently available",
  "errorData": {}
}

In a similar issue, I saw that it related to the current plan I have. I have the fixed plan. So if I change to the scale Plan, do this request could be ok, or it’s about another issue? This is my cURL.


--data-raw '{
    "id": 0,
    "orderDate": "06/14/2024 18:36:02",
    "eventDate": "06/06/2024 02:00:00",
    "amount": 0.0,
    "feeAmount": 0.0,
    "hasInsurance": false,
    "hasLitige": false,
    "isPaid": false,
    "isPaymentSent": false,
    "isMoneyTransfered": false,
    "linkedClientId": 12,
    "linkedMainClient": {
        "objectId": "FCAAFEFD-69CF-48FF-A1D8-F6EE317147D8",
        "userId": 12,
        "address": "76 Avenue d'\''Oberkorn, Oberkorn Differdange, Luxembourg",
        "location": {
            "coordinates": [
                5.8974394,
                49.5189477
            ],
            "type": "Point"
        },
        "email": "inveders@hotmail.fr",
        "firstname": "Alexandra",
        "lastname": "Gnim",
        "phoneNumber": "+352661760160",
        "phoneCode": "+352",
        "profileImage": "myapp/api/files/user-profile-image/+352661760160wXqGEtZc0w.jpg",
        "user-token": "",
        "stripeCustomerId": ""
    },
    "linkedSecondaryClient": null,
    "linkedEventId": 41,
    "linkedEvent": {
        "objectId": "5894E971-4AF0-4774-9CAC-F1C7C5208C32",
        "name": "Anniversaire de Yann",
        "id": 41,
        "location": {
            "coordinates": [
                5.899760499999999,
                49.522108
            ],
            "type": "Point"
        },
        "isRecurrentEvent": false,
        "linkedClientId": 12,
        "linkedClient": {
            "objectId": "FCAAFEFD-69CF-48FF-A1D8-F6EE317147D8",
            "userId": 12,
            "address": "76 Avenue d'\''Oberkorn, Oberkorn Differdange, Luxembourg",
            "location": {
                "coordinates": [
                    5.8974394,
                    49.5189477
                ],
                "type": "Point"
            },
            "email": "inveders@hotmail.fr",
            "firstname": "Alexandra",
            "lastname": "Gnim",
            "phoneNumber": "+352661760160",
            "phoneCode": "+352",
            "profileImage": "myapp/api/files/user-profile-image/+352661760160wXqGEtZc0w.jpg",
            "user-token": "",
            "stripeCustomerId": ""
        },
        "needsList": "3",
        "places": [
            {
                "objectId": "CBE212D1-20A4-4B1C-9BA5-DBEA818CA7DB",
                "id": 30,
                "startDatePlace": "06/06/2024 02:00:00",
                "endDatePlace": "06/06/2024 02:00:00",
                "startHour": "15:00",
                "endHour": "17:00",
                "eventType": 4,
                "hasSono": false,
                "hasSoundEngineer": false,
                "numberGuests": 1,
                "address": "115 Rue Emile Mark, Oberkorn Differdange, Luxembourg",
                "location": {
                    "coordinates": [
                        5.899760499999999,
                        49.522108
                    ],
                    "type": "Point"
                },
                "placeName": "",
                "musicStylesList": "5",
                "onSiteEquipmentList": "1",
                "songsRangeNumber": 1
            }
        ],
        "smsNotification": false,
        "emailNotification": false,
        "status": 1,
        "hostelTakenInCharge": false,
        "earlyArrival": false,
        "foodTakenInCharge": false,
        "numberRepetitions": 0,
        "requiredLevel": 0,
        "playClicker": false,
        "visibleInProviderSearch": true,
        "coorganizer": null,
        "linkedCoorganizer": null
    },
    "linkedProviderId": 36,
    "linkedProvider": {
        "objectId": "231BD911-429A-4A43-B1C8-EC4DBCA1F732",
        "id": 36,
        "isSolo": false,
        "bandStyle": [
        ],
        "averageRate": null,
        "address": "138 Rue Victor Hugo, Esch-sur-Alzette, Luxembourg",
        "location": {
            "coordinates": [
                5.97430927,
                49.49620278
            ],
            "type": "Point"
        },
        "description": "Nous sommes le groupe de louange de l'\''église la Source à Esch au Luxembourg.",
        "providerType": 1,
        "emailAddress": "alexandra.gnimadi@gmail.com",
        "eventTypeList": "2",
        "hasOwnSoundEngineer": false,
        "linkedOwnerClientId": 12,
        "medias": [
        ],
        "members": [
        ],
        "movingAroundKm": 50,
        "name": "Worship la Source",
        "numberMembers": 1,
        "phoneNumber": "661760160",
        "phoneCode": "+352",
        "countryCode": "LU",
        "instrumentList": "",
        "pricing": [
        ],
        "unavalaibleDates": [
        ],
        "profileImage": "",
        "sonoInfos": null,
        "playClicker": false,
        "profileStatus": 1
    },
    "isFeesFilled": true,
    "isClientNeedReworkFees": false,
    "step": 2
}' \
--proxy http://localhost:9090

This will be most likely operation count in your transaction. If I am not mistaking then any plan comes with 5 operations, and it can be expanded with function pack for additional operations.

Hello, ok thanks you for the information. How could I know how many operations I have in this cURL for example? It’s permit me to know how I manage this. It’s depend on each object I have to write in my table? The number is count by api call ? in a minute in an api call? How is it calculated?
Thanks you

Deep Save relies on Transaction, and transaction consists of operations. Here you can read about what operation is considered:
https://backendless.com/docs/rest/data_transactions_about_unitofwork.html#operations