[DOCS-13799] [Atlas] Update database user PATCH curl command example does not work Created: 28/Jul/20  Updated: 29/Oct/23  Resolved: 05/Aug/20

Status: Closed
Project: Documentation
Component/s: API, Atlas
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Yuta Arai Assignee: Steve Renaker (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

mac os catalina, zsh


Participants:
Days since reply: 3 years, 27 weeks ago
Story Points: 2

 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"} 

Scope of changes

Impact to Other Docs

MVP (Work and Date)

Resources (Scope or Design Docs, Invision, etc.)



 Comments   
Comment by Steve Renaker (Inactive) [ 05/Aug/20 ]

PR: https://github.com/10gen/cloud-docs/pull/1759

Generated at Thu Feb 08 08:08:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.