Closed eduardoagr closed 2 years ago
You didn't include the exception (looks like a copy/paste mistake). And you didn't include any details about your db structure (e.g. what properties the Note object has).
Sorry @cabauman
this is mt database structure
"Notebooks" : { "-MxdwMGbOdhmL85JoX9K" : { "Color" : "#FF008000", "CreatedDate" : "Tuesday, March 8, 2022", "Name" : "NOTEBOOK", "UserID" : "4B7L4mRordT2s373NCwgNLesxj13" } }, "Notes" : { "-MxepAH9BW0Uv065a5LR" : { "FileLocation" : "", "Name" : "ed", "NotebookId" : "-MxdwMGbOdhmL85JoX9K" } } }
this is how I am trying to update
` await firebaseClient .Child(AppConstant.Notes) .Child(Id) .PatchAsync(FileLocation); }``
Exception
Firebase.Database.FirebaseException: 'Exception occured while processing the request. Url: https://duonotes-f2b77-default-rtdb.europe-west1.firebasedatabase.app/Notes/-MxepAH9BW0Uv065a5LR/.json?print=silent Request Data: https://notesbucket.blob.core.windows.net/notes/ed.html Response: { "error" : "Invalid data; couldn't parse JSON object. Are you sending a JSON object with valid key names?" } '
Xamarin forms 5.0 Android version 11 Windows 11 Visual studio 2022 Comunity
One more question.
.PatchAsync(FileLocation);
Is FileLocation a string?
@cabauman yes it is
Patch needs an object:
.PatchAsync($"{{ \"FileLocation\" : \"{FileLocation}\" }}");
why do I have to put \
It's json so we have to escape the quotes. I hope it helped.
yes thank you @cabauman
I have a child Notes, and I want to update just the file location
`public async void UpdateNotebookNote(string Id, string FileLocation) {
but when I do this, I get this exception
`public async void UpdateNotebookNote(string Id, string FileLocation) {