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 authorization token is correct. What I am not sure however is what I should pass for the resource id and resource type.
payLoad := LowerCase(Verb) + #10+
LowerCase(resourceType) + #10+
LowerCase(resourceId) + #10+
LowerCase(utc_date) + #10 +
'' + #10; //instead of the "date" header
For the POST (which works), I use
"docs" and "dbs/mydb/mycol/licenses"
For DELETE I use the value of the "_self" property for the url of the doc to be deleted. I tried just about any combination of resource type and resource id I could think of:
docs dbs/icUoAA==/colls/icUoAKizCgA=/docs
docs dbs/icUoAA==/colls/icUoAKizCgA=/docs/icUoAKizCgADAAAAAAAAAA==
docs dbs/icUoAA==/colls/icUoAKizCgA=/docs/icUoAKizCgADAAAAAAAAAA==/
docs/icUoAKizCgADAAAAAAAAAA== dbs/icUoAA==/colls/icUoAKizCgA=/docs
docs/icUoAKizCgADAAAAAAAAAA== dbs/icUoAA==/colls/icUoAKizCgA=/docs/icUoAKizCgADAAAAAAAAAA==
etc.
DELETE however always fails with 401. Do I need to use something different?
Thank you!
Delete Document REST APIdocumentation - msdn.microsoft.com/en-us/library/azure/mt489087.aspx, I noticed that it expects the document name instead of system assigned resource id while you're using the resource id. Could that be the reason for this error you're getting? - Gaurav Mantri