Good afternoon! Go rest got updated, and i had tried to manipulate data with root :"https://gorest.co.in/public/v2/users/2861547/posts. I can successfully get data from this user, can add some more posts to it, can patch them, but when it comes to deletion server gives 404 error. I wonder if method i use is wrong, but what i am doing is just getting post by its id, for example(https://gorest.co.in/public/v2/users/2861547/posts?id=44326) - here is link i fetch. Then i put method: 'DELETE' and all necessary headers but it still doesnt work. Maybe the problem is about fetching this link, i might need to fetch something instead but i dont really know what should i fetch instead. Thanks in advance.
here is my delete method(fetch link is mentioned above)
static delete(id) {
return fetch(${this.URL}?id=${id}
, {
method: 'DELETE',
headers: this.HEADERS,
})
.then((res) => {
if (res.status !== 204 || !res.ok) {
throw new Error("Deletion was not successful")
}
})
}
Can you please try.
DELETE /public/v2/posts/12345
Replace id with your post id
Yes it worked, thanks a lot, appreciated!!!!