Update User Email

Hi,

I am trying to update a users email address using the /api/v2/users/{userId} endpoint and only want to update the email, however, I am having an issue with the JSON file. Can anyone assist?

Thank you.

Kind Regards,
Chris Carr

Hi Chris,

We are going to need a little more detail. Can you provide the correlation id or post the error message and/or status code that you are getting. Otherwise, we have nothing to really identify your call from any of the other calls out there.

Thanks,
John Carnell
Manager, Developer Engagement

Syntax should just be;

PATCH /api/v2/users/{userId}
{
"email": "peep@my.co",
}

Hi,

Thank you, this will not work due to required fields.

kind Regards,

Hi John,

Thank you, the error is due to required fields, however, I am struggling to create the JSON that includes the email as well as the required fields.

Do you have an example or template that I may use?

Thank you

{
"message": "Validation error(s): [API Exception 400:"Bad Request" : Illegal value for field: version, Reason: Missing data for required field.]",
"code": "general.bad.request",
"status": 400,
"messageParams": {
"fieldName": "version",
"errorCode": "GENERAL_BAD_REQUEST"
},
"contextId": "dfa57e95-4e8c-4a15-98ce-99ed44b31981",
"details": [],
"errors": []
}

Hi John,

At the moment I am receiving the following error:

{
"message": "'where' is a required field",
"code": "general.bad.request",
"status": 400,
"messageParams": {
"fieldName": "where",
"errorCode": "GENERAL_BAD_REQUEST"
},
"contextId": "37077de9-f752-4cfb-b505-d44fbb1a9f95",
"details": [],
"errors": []
}

Perhaps you should post an example of exactly what you're trying to submit rather than just the error you're getting, because patch should not have required fields. It's an update to an already present and complete entity.

I have been able to find my error. Version is a required field that I was missing.

PATCH /api/v2/users/{userId}
{
"email": "email@my.co",
"version": 2
}

1 Like

Hi Chris,

Thanks, I was just getting ready to send a response on exactly this topic. I am going to make a note to add a small article to the users API to help developers avoid getting tripped up on this. I personally believe our users API should have never exposed the version information in the public interface because it is a leaked implementation detail. I am hoping in the future it will be refactored to make it an irrelevant field.

Thanks,
John Carnell
Manager, Developer Engagement

1 Like

Hi John,

Thank you for you response and assistance.

Kind Regards,
Chris

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.