5 Replies Latest reply on Oct 8, 2019 11:01 AM by john_reynolds

    How to disable a user by API v3

    fabricequentin

      Hi,

       

      I would like disable some inactive users on my platform.

       

      I tried by API v3

      Example :

      curl -X PUT -u username:password -H "Content-Type: application/json" -d '{"jive.enabled":"false"}' "https://mysite.com/api/core/v3/people/nnnnn"

       

      And I received the message :

       

      {

        "error" : {

          "status" : 400,

          "message" : "E-mail avec liste Jive « e-mail » manquante"

       

      Could you help me to format correct my curl request, please ?

       

      Regards

      Fabrice.




        • Re: How to disable a user by API v3
          mattj18

          Hello Fabrice QUENTIN,

           

          When updating a user, the "emails" field is mandatory in the PUT request, among other values. It must be added to your JSON. I recommended reading this thread: Re: I need an example showing how to update a person's information (Name, Phone numbers, Email, Title, Department, etc) using the API, can somebody help me please?  The thread contains details about other required fields. It also has some helpful comments about possible errors you may receive.

          1 person found this helpful
            • Re: How to disable a user by API v3
              fabricequentin

              Thank you very much Matt  but i tried to do this and the result is no error after the process but no changes concerning the person to update

              Example :

              curl -X PUT -u `cat fqnl.txt`:`cat fqnp.txt` --verbose -H "Content-Type: application/json" -d @fqn.json "https://younity.groupeadeo.com/api/core/v3/people/25179"

               

              Reply :

              * About to connect() to younity.groupeadeo.com port 443 (#0)

              *   Trying 99.81.103.35...

              * Connected to younity.groupeadeo.com (99.81.103.35) port 443 (#0)

              * Initializing NSS with certpath: sql:/etc/pki/nssdb

              *   CAfile: /etc/pki/tls/certs/ca-bundle.crt

                CApath: none

              * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

              * Server certificate:

              *       subject: CN=younity.groupeadeo.com,O=Groupe ADEO,L=Ronchin,C=FR

              *       start date: Jan 08 14:39:53 2019 GMT

              *       expire date: Oct 11 15:09:52 2020 GMT

              *       common name: younity.groupeadeo.com

              *       issuer: CN=Entrust Certification Authority - L1K,OU="(c) 2012 Entrust, Inc. - for authorized use only",OU=See www.entrust.net/legal-terms,O="Entrust, Inc.",C=US

              * Server auth using Basic with user '20000077'

              > PUT /api/core/v3/people/25179 HTTP/1.1

              > Authorization: Basic MjAwMDAwNzc6WW9nb25vdjc3Nzkh

              > User-Agent: curl/7.29.0

              > Host: younity.groupeadeo.com

              > Accept: */*

              > Content-Type: application/json

              > Content-Length: 291

              >

              * upload completely sent off: 291 out of 291 bytes

              < HTTP/1.1 400 Bad Request

              < Date: Mon, 07 Oct 2019 17:00:10 GMT

              < Content-Type: application/json

              < Transfer-Encoding: chunked

              < Connection: keep-alive

              < Set-Cookie: AWSALB=FvnbXcXYuhN6F9ONmJvDKkKJF8ES+iqSqZprxsO2Wc0vxvMCKh4fcep/uaA6RSYnXU+s22LM+shnjg5WYrzqAQ3tojIzK4kmbOPH0KlGPdqNmlXFDj3y/dqEzFh6; Expires=Mon, 14 Oct 2019 17:00:09 GMT; Path=/

              < Server: Apache

              < X-Jive-Request-Id: eba58050-e923-11e9-b328-00505683325a

              < X-Jive-Flow-Id: eba58051-e923-11e9-b328-00505683325a

              < X-Frame-Options: SAMEORIGIN

              < P3P: CP="CAO PSA OUR"

              < X-JIVE-USER-ID: 25086

              < Expires: Mon, 07 Oct 2019 17:00:09 GMT

              < Vary: Accept-Encoding,User-Agent

              < Cache-Control: no-store, no-cache, must-revalidate, private, max-age=0

              < X-JSL: D=486770 t=1570467609812698

              < Set-Cookie: jive.login.ts=1570467609813; Path=/; Secure; HttpOnly

              < Set-Cookie: jive.user.loggedIn=true; Path=/; Secure; HttpOnly

              < Set-Cookie: jive.server.info="serverName=younity.groupeadeo.com:serverPort=443:contextPath=:localName=localhost:localPort=9200:localAddr=127.0.0.1"; Version=1; Path=/; Secure; HttpOnly

              <

              {

                "code" : 400,

                "message" : "Unexpected end-of-input: expected close marker for OBJECT (from [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@44c6f82b; line: 1, column: 0])\n at [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@44c6f82b; line: 1, column: 583]"

              * Connection #0 to host younity.groupeadeo.com left intact

               

               

              See attached file fqn.json :



              Thanks by advance for your help



               






            • Re: How to disable a user by API v3
              fabricequentin

              Hi Matt,

               

              Thank you for your help

               

              Finally, i had to add others fields to complete the json :

              { "emails" : [ { "jive_label" : "Email", "value" : "anonymous@dummy.com" } ], "jive" : { "enabled" : false, "federated" : false, "username": "xxxxxxxx" }, "name" : { "familyName" : "anonymous", "givenName" : "anonymous" } }
              and now it works fine.

              Have a nice day.

              Fabrice.

               

               

               

               

               

               

                • Re: How to disable a user by API v3
                  john_reynolds

                  Best practice is always to:

                  1. use GET /people/{personID} to load the entire user object for that user

                  2. With the Person object JSON, change "enabled" from true to false
                  3. Use PUT /people/{personID} with the Person Object as the payload

                   

                  Do not just try construct a small Person object to PUT back as the payload. If fields are missing or blank, then they will overwrite (with blanks) the existing user data.

                  1 person found this helpful