Can't update through API

I am not familiar with Ajax and this may seem like a silly question but

according to the documents

Create / Update collection entries

fetch('/api/collections/save/posts?token=xxtokenxx', {
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        data: {...}
    })
})
.then(res=>res.json())
.then(entry => console.log(entry));

I can insert new entries but I cannot update any of my entries.
would you please give me an example to how I can update an existing entry ?

@Hypothesis-github
An update is triggered when your data structure contains a valid _id, are you passing the entry _id in the request? For me below works well:

2 Likes

Thanks dude, I got it working with you mentioning the “_id”

This solution is not working with me, take a look at my code and the payload being sent