Details
Description
Description
https://docs.atlas.mongodb.com/reference/api/database-users-update-a-user/#request
Ran into a HTTP/1.1 415 Unsupported Media Type error when running the following PATCH command in the docs to update database user:
curl -i -u "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest -X PATCH "https://cloud.mongodb.com/api/atlas/v1.0/groups/5356823b3794dee37132bb7b/databaseUsers/admin/david" --data '
|
{
|
"roles" : [ {
|
"databaseName" : "service",
|
"roleName" : "read"
|
} ]
|
}'
|
Response:
HTTP/1.1 401 Unauthorized |
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="nPgaeMDYtT5RsthCvXu2SXmQS/sZY+7z", algorithm=MD5, qop="auth", stale=false |
Content-Length: 0 |
|
HTTP/1.1 415 Unsupported Media Type |
Content-Length: 0 |
PATCH succeeded when I added headers:
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
|
--header "Accept: application/json" \
|
--header "Content-Type: application/json" \
|
--include \
|
--request PATCH "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/databaseUsers/admin/yuta" \
|
--data '
|
{
|
"roles" : [ {
|
"databaseName" : "service",
|
"roleName" : "read"
|
} ]
|
}'
|
Response:
HTTP/2 401 |
www-authenticate: Digest realm="MMS Public API", domain="", nonce="iBIsKM/ICvvWO7cckkB6ZMehR7kptIlN", algorithm=MD5, qop="auth", stale=false |
content-length: 0 |
|
HTTP/2 200 |
content-type: application/json
|
strict-transport-security: max-age=31536000 |
date: Tue, 28 Jul 2020 23:29:30 GMT |
x-mongodb-service-version: gitHash=e38b02813fc192008435be13485f874ebb9e1313; versionString=v20200721
|
x-frame-options: DENY
|
content-length: 338 |
|
{"awsIAMType":"NONE","databaseName":"admin","groupId":"5c491c2a014b769426cdbec2","labels":[],"ldapAuthType":"NONE","links":[{"href":"https://cloud.mongodb.com/api/atlas/v1.0/groups/5c491c2a014b769426cdbec2/databaseUsers/admin/yuta","rel":"self"}],"roles":[{"databaseName":"service","roleName":"read"}],"username":"yuta","x509Type":"NONE"} |