Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-13799

[Atlas] Update database user PATCH curl command example does not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • None
    • API, Atlas
    • None
    • mac os catalina, zsh
    • 2
    • CET: Andromeda (4-10 Aug 2020)

    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.)

      Attachments

        Activity

          People

            steve.renaker@mongodb.com Steve Renaker (Inactive)
            yuta.arai@mongodb.com Yuta Arai
            Jess Mokrzecki Jess Mokrzecki
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              3 years, 8 weeks, 6 days ago