Is there a way to CREATE a record if it doesn't exist or UPDATE a row if it does exist?

Hi,
I would like to create a record if it doesn’t exist or update a record if it does exist?
Thanks,
Carlton

Hi Carlton,

What you describe is typically referred to as “upsert”. This is on our roadmap. Currently, the “save” API operation checks if the object you are saving has the objectId property with a value. If it does, it is the update operation, otherwise it is create. The upsert goes further and checks if the object with the specified objectId actually exists in the database.

Regards,
Mark

Thanks. I didn’t know it had an official name. I managed it by checking the data base and then choosing the operational based on the result. It works just fine. I look forward to the update :slight_smile:

Hello. Are there any updates as to when upsert might become available? I’d like to update or add data with dynamic objectIds that may not currently exist in db.

Hi Chris,

The REST implementation is already on the server. We’re updating our SDKs and documentation with the added APIs. What Backendless SDK do you use in your app?

Regards,
Mark

OK that’s great news. I’m currently using the JS SDK, but I can do a workaround with the REST apis as needed for those specific calls until it becomes available. Thanks for quick reply!