I'm trying CosmosDB Emulator using REST API from PHP. For that I'm using AzureDocumentDB-PHP.
This wrapper library is referring to the MSDN documentation for the REST API. I'm seeing a difference between MSDN documentation and docs.microsoft.com
For example, to retrieve a single document MSDN says use the following syntax:
https://{databaseaccount}.documents.azure.com/dbs/{_rid-db}/colls/{_rid-col}/docs/{_rid-doc}
Whereas the docs.microsoft.com says use the below syntax:
https://{databaseaccount}.documents.azure.com/dbs/{db-id}/colls/{coll-id}/docs/{doc-id}
Note the difference, MSDN uses _rid
(system generated id), where as docs.microsoft.com uses just the id
(user generated id).
The mentioned PHP library which is using MSDN syntax works fine with the _rid (system generated id). If I try to use the user generated id, I get the following error (for trying to get a db):
{"code":"Unauthorized",
"message":"The input authorization token can't serve the request.
Please check that the expected payload is built as per the
protocol, and check the key being used. Server used the
following payload to sign:
'get
dbs
dbs/db_test
thu, 25 jan 2018 10:28:30 gmt
'
ActivityId: a43be1a0-c35b-4438-bb83-522204d3f589,
Microsoft.Azure.Documents.Common/1.19.102.5"}' (length=388)