Why getting error when deleting a document from using public rest api

curl -X DELETE --header ‘Accept: application/json’ ‘http://localhost:4984/mydb/5e9f25dd4275a3f2a53e4cff4e?rev= 523-151fbfd90000000000000’

I am getting this error when calling the delete api .
error :
{
“error”: “conflict”,
“reason”: “Document revision conflict”
}

maybe you use wrong rev value, try get the document with latest rev.

thanks for your reply .
how to i going to know which is the latest rev id .

Use the GET API. You response would look something like this …The_rev is what you you should use in your subsequent UPDATE or DELETE.

{
    "_id": "user::demo",
    "_rev": "1-b61639e862df19c40215f35ee80cd12f",
    "_revisions": {
        "ids": [
            "b61639e862df19c40215f35ee80cd12f"
        ],
        "start": 1
    },
    "channels": [
        "_demo"
    ],
    "value": "foo"
}

Hi,

Be sure that you are not using the rev id displayed on right side of web admin panel. That was the mistake which we faced at the begining.

1 Like