Skip to main content

I want to change my primary address with the REST API.

  • November 30, 2023
  • 5 replies
  • 154 views

I want to change my primary address with the REST API


https://api.box.com/2.0/users

I would like to change the primary email address of the target user by using login as a parameter in the “login” section, but I cannot do so because of a 400 error.


It is a bad_request, but can’t I change the primary address using info?


{“type”: “error”, “status”:400, “code”: “bad_request”, “context_info”:{“errors”:{“reason”: “invalid_parameter”, “name”: “new_primary_ email”, “message”: “Invalid value ‘change-test@test.com’.”}]} , “help_url”: “http:/developers.box.com/docs/#errors”, “message”: “Bad Request”, “request_id”: “nwogfbhkcvt2r3mk”}%.

5 replies

CodeBoxSeb
  • Participating Frequently
  • 58 replies
  • November 30, 2023

Hi @fantasista 😀


According to the Request ID you provided, the email alias is not confirmed.

You must confirm the email alias before changing the primary email address.


For example, in the WebApp, when you need to change an email, you need to set up the email as secondary email, then confirm the email (with a email you receive) and finally switch the secondary email with the primary email.


  • Author
  • New Participant
  • 2 replies
  • November 30, 2023

Thank you for your response.


Does the address I register as an alias also need to be able to receive email?

Is there a problem with dummy addresses?


Also, if you want to change the alias to primary, I would appreciate your advice on how to run the API


CodeBoxSeb
  • Participating Frequently
  • 58 replies
  • December 1, 2023

Hi !


Yes, you need to use an email address that is able to receive email indeed.


To change an email, can you please check this page :



The argument to use is : login



The email address the user uses to log in




Note: If the target user’s email is not confirmed, then the primary login address cannot be changed.



  • Author
  • New Participant
  • 2 replies
  • December 1, 2023

Thank you for your response!


I would like to review the procedure.



  1. set the alias to an email address that will be able to receive the changes

  2. confirm receipt with the email address registered in the alias

  3. Use the REST API with the argument “login” to change the primary address to the alias address.

  4. confirm that the primary address has been changed


Please let me check if the above procedure is OK.


CodeBoxSeb
  • Participating Frequently
  • 58 replies
  • December 4, 2023

Hi @fantasista


Yes, your procedure looks correct indeed.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings