Update a user profile
Updates a user profile based on input from a user in an edit profile form. To make this call, you must have a valid Registration access token for the user record to be updated.
Authentication
No authentication is required to call this operation.
Base URL
The base URL for this operation is your Identity Cloud Capture domain; for example:
https://educationcenter.us-dev.janraincapture.com
Your Capture domains (also known as Registration domains) can be found in Console on the Manage Application page:
Setting boolean fields to false
If you need to set the value of a Boolean field (i.e., a checkbox field) to false, you should not include that field in your API call and you should not set the value to false. In other words, this syntax will not set the boolean field newsletterSubscriber to false:
--data-urlencode 'newsletterSubscriber=false'
In fact, the preceding code actually sets newsletterSubscriber to true. That's because of the way that the Authentication APIs handle boolean values: if a boolean attribute is included in your API call the value of that attribute is automatically set to true regardless of the value specified in the API call. If the attribute is included the value is set to true; if the attribute is not included then the value is set to false. To set a boolean value to true, just include the attribute in the body parameter and set the value to either true or false (it doesn't matter which).
But keep the following scenario in mind. A user already has the newsletterSubscriber attribute set to true. You make an API to call to change the user's display name and don't bother adding newsletterSubscriber to the API call. Because newsletterSubscriber isn't in the API call, the value of the newsletterSubscriber attribute is automatically changed to false. To keep a boolean attribute set to true you must include that attribute in all API calls that update the user profile.
Examples
Example 1: Update profile data
This command updates the displayName attribute for the user who was issued the access token z0y98xv76u5t4rs3.
curl -X POST \
--data-urlencode 'client_id=12345abcde12345abcde12345abcde12'\
--data-urlencode 'flow=standard'\
--data-urlencode 'flow_version=20190618143040022299''\
--data-urlencode 'locale=en-US'\
--data-urlencode 'form=editProfileForm'\
--data-urlencode 'displayName=JaneDoe'\
--data-urlencode 'access_token=z0y98xv76u5t4rs3'\
'https://my-app.janraincapture.com/oauth/update_profile_native'
Example 2: Update profile data in a date select field
This command updates the birthdate attribute for the user who was issued the access token z0y98xv76u5t4rs3.
curl -X POST \
--data-urlencode 'client_id=12345abcde12345abcde12345abcde12'\
--data-urlencode 'flow=standard'\
--data-urlencode 'flow_version=20190618143040022299''\
--data-urlencode 'locale=en-US'\
--data-urlencode 'form=editProfileForm'\
--data-urlencode 'birthdate[dateselect_year]=1930'\
--data-urlencode 'birthdate[dateselect_month]=11'\
--data-urlencode 'birthdate[dateselect_day]=3'\
--data-urlencode 'access_token=z0y98xv76u5t4rs3'\
'https://my-app.janraincapture.com/oauth/update_profile_native'
Example 3: Change password from profile
This command changes the password for the user who was issued access token z0y98xv76u5t4rs3. Note that this command requires you to supply:
- The user’s current password (currentPassword)
- The user’s new password (newPassword)
- Confirmation of the user’s new password (newPasswordConfirm)
curl -X POST \
--data-urlencode 'client_id=12345abcde12345abcde12345abcde12'\
--data-urlencode 'flow=standard'\
--data-urlencode 'flow_version=20190618143040022299''\
--data-urlencode 'locale=en-US'\
--data-urlencode 'form=changePasswordForm'\
--data-urlencode 'currentPassword=password123'\
--data-urlencode 'newPassword=Password1'\
--data-urlencode 'newPasswordConfirm=Password1'\
--data-urlencode 'access_token=z0y98xv76u5t4rs3'\
'https://my-app.janraincapture.com/oauth/update_profile_native'
Example 4 - Change password from a reset password link
This command resets a user’s password after a reset password verification code has been submitted. (When you submit the reset password verification code you’ll be given an access token; that token must be used as the value of the access_token parameter.) Note that you only have to specify the user’s new password; you don’t have to supply the user’s old password.
curl -X POST \
--data-urlencode 'client_id=12345abcde12345abcde12345abcde12'\
--data-urlencode 'flow=standard'\
--data-urlencode 'flow_version=20190618143040022299''\
--data-urlencode 'locale=en-US'\
--data-urlencode 'form=changePasswordFormNoAuth'\
--data-urlencode 'newPassword=Password2'\
--data-urlencode 'newPasswordConfirm=Password2'\
--data-urlencode 'access_token=z0y98xv76u5t4rs3'\
'https://my-app.janraincapture.com/oauth/update_profile_native'
Parameters
All parameters need to be configured as x-www-form-urlencoded body parameters.
Parameter | Type | Required | Description |
---|---|---|---|
access_token | string | Yes | Registration access token returned after authentication or registration with a previous call (/oauth/auth_native, /oauth/auth_native_traditional, and so on) if the response_type parameter was set to token. If the response_type was set to code, you must exchange the authorization code for an access token using the /oauth/token call. |
client_id | string | Yes | API client ID used to authenticate the call. This client must be configured with the login_client feature, which gives it permission to use login and registration-based API endpoints. API client permissions may be configured by using the clients/set_features endpoint. |
flow | string | Yes | Name of the flow configured with the login experience you want to use. This parameter corresponds to the janrain.settings.capture.flowName JavaScript setting used in widget- based implementations. The default flow provisioned with Registration applications is named the standard flow; if you have multiple flows, you can find a list of valid flow names using the Configuration API. |
flow_version | string | Yes | Yes Version number of the flow set in the flow parameter. This parameter corresponds to the janrain.settings.capture.flowVersion JavaScript setting used in widget-based implementations; however, this call will not accept a version of HEAD. Instead, you must specify the version number if you want to use the most recent version. You can find a list of versions for your flow using the Configuration API. |
forms | string | Yes | Name of the form to be used to for profile updates. This parameter determines the field names that must be included when submitting this API call. The default form name for user profile management configured for the standard flow is editProfileForm, but you can find a list of valid forms and associated fields for your flow using the Configuration API. This form name corresponds to the name of the JTL tag used for the associated form in widget-based implementations (for example, {* #editProfileForm *}). |
{form_fields} | string | Yes | Names of any other fields that are configured in your flow with a profile management form. Each field must be passed as a separate parameter; you will use the field name as the key and the user input as the value. All fields required in the flow for the form passed in the call must be included if the user record does not have existing data stored in the associated attribute. The default editProfileForm provisioned for the standard flow includes emailAddress, firstName, lastName, and displayName as required fields and several others as optional. You can find a list of valid fields for your profile management forms using the Configuration API. These field names correspond to the name of the JTL tags included inside the associated form in widget-based implementations. |
locale | string | Yes | Code for the language you want to use for the profile management experience. This parameter determines the language for any error messages returned to you and any emails sent by Akamai to users and corresponds to the janrain.settings.language JavaScript setting used in widget-based implementations. The default locale provisioned with the standard Registration flow is en-US; other locales must be configured in your flow. You can find a list of valid locales for your flow using the Configuration API. |
Responses
200 OK
Successful response
A successful call returns the following response:
{
"stat": "ok"
}
Error - Invalid registration access token
The example error response below indicates that the Registration access token passed into the call is invalid or expired.
{
"stat": "error",
"code": 413,
"error_description": "invalid access token",
"error": "invalid_access_token",
"request_id": "9xmecweny6bxt5n2"
}
Error - Field validation errors
The example error response below indicates that validation failed for some fields configured with the form used in the call. All validation rules for these fields are checked, so you may receive errors for multiple fields and multiple errors on a single field. Validation errors are commonly encountered when a required field is missing, the email address or another unique field is already taken, or the user input does not pass formatting validation applied to a field. Note that if the user record does not have existing data stored for any field configured as required in the flow for the form passed in the call, that field must be included as a parameter. The invalid_fields object will include field names mapped to a list of localized error messages from the flow for each validation that failed.
{
"stat": "error",
"code": 390,
"error_description": "some inputs are invalid",
"error": "invalid_form_fields",
"request_id": "eyt2p5thkwch5h2h",
"invalid_fields": {
"displayName": [
"That display name is already taken."
],
"lastName": [
"Last Name is required."
]
}
}
Error - Invalid credentials
The example error response below indicates that the value entered for the user's current password failed on the change password form. The invalid_fields object will include a localized error messages from the flow.
{
"stat": "error",
"code": 210,
"error_description": "some inputs are invalid",
"error": "invalid_credentials",
"request_id": "zqnw6qzqxy2yvee8",
"invalid_fields": {
"changePasswordForm": [
"Current password is incorrect. Please try again."
]
}
}
Error - Missing required parameters
The example error response below indicates that one of the required parameters for the call was not included. The error message will describe which parameter is missing.
{
"stat": "error",
"code": 100,
"error_description": "missing arguments: flow",
"error": "missing_argument",
"request_id": "uyeem84bmqmnjuu4"
}
### Error - Invalid flow value
The example error response below indicates that the value provided for one or more of the flow, flow_version, or locale parameters is invalid. Flow versions are unique across environments, so check that the version value included in the call is for the correct environment (that is, your development or production application).
{
"stat": "error",
"code": 500,
"error_description": "could not find a flow named 'standard' with version '12345abc-1234-abcd-1234-12345abcde12' and locale 'en-US'",
"error": "unexpected_error",
"request_id": "murynd7fhpysq6um"
}
Error - Invalid API client permissions
The example error response below indicates that the API client used to make the call is not configured with the login_client feature.
{
"stat": "error",
"code": 403,
"error_description": "This client does not support log in and registration.",
"error": "permission_error",
"request_id": "y3sthb9dey6mv65e"
}
Updated almost 2 years ago