DocumentDB - DELETE causes 401 error

前端 未结 1 946
感情败类
感情败类 2021-01-23 10:37

I always get 401 when I try to execute a DELETE verb against a DocumentDB collection. POST for queries/inserts/updates works fine, so I am sure that my code that calculates the

相关标签:
1条回答
  • There's two kinds of requests you can make to DocumentDB. One is based on the "id" property that you define, and one based on the internal resource id ("_rid"). When you're using "id", you need to use the entire link for generating the authorization token, so for delete it would look like

    delete
    docs
    dbs/mydb/colls/mycol/docs/cc0d4caabc714aac976c9d0a2e9243ed
    sun, 21 aug 2016 20:00:00
     //newline
    

    If you're using the internal resource ID, then you just pass in the "_rid" of the document you're trying to delete, for example

    delete
    docs
    icuoakizcgadaaaaaaaaaa== //lowercase
    sun, 21 aug 2016 20:00:00
     //newline
    

    One thing which might help debugging these is looking at the response body that's returned with the 401. It should contain an error message telling you the payload that the server expected.

    0 讨论(0)
提交回复
热议问题