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

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”}%.

Hi @fantasista :grinning:

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.

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

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.

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.

Hi @fantasista

Yes, your procedure looks correct indeed.