Update account
PUT /accounts/{account_id}
Modifies an existing account, usually in order to update some core information such as email.
As a matter of fact, you can only modify YOUR account. If you created another guy's account, you will not be able modify it afterwards with your access token. Only an app created by that user will be able to modify it. Let's assume here that you are John Smith, and that you want to update your account.
Parameters
account_id
(string) - Id of the account
Page content
Minimal curl example
curl -ig 'https://api.mention.net/api/accounts/{account_id}' \
-X PUT \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'Accept-Version: 1.19' \
-d '{"name":"NEW_ACCOUNT_EMAIL"}'
As you see in the curl example, there is no minimal requirement in the PUT request in terms of attributes sent. Therefore, you can modify only a single parameter if you wish to.
Available properties
Modifiable attributes are a subset of those of the POST request. It is all attributes marked as 'updatable' below:
Properties | _ | Definition | Example | Updatable |
---|---|---|---|---|
name | required | Account name | "John Smith" |
yes |
required | Account email | "j.smith@nasa.com" |
yes | |
phone | optional | Account phone number | "(202) 358-0001" |
yes |
password | required | Account password. At least 6 characters | Mypass1 |
yes |
language_code | required | Two characters language code | en |
yes |
client | optional | Client name (e.g. the application name) that was used to register this user | appTestMention |
no |
default_notification_phone | Phone data for sms notifications | {"number": +33123456789} |
yes |
Updatable
This column indicates all attributes that can be updated via a PUT request
Beware! If you want to update the password, you need to pass 2 attributes:
old_password
andnew_password
Name
name
User name
email
User email. Min 2 characters, Maximum 255 characters.
Phone
phone
User phone number.
Password
password
User Password. Should include letters, figures, and be at least 6 characters long.
Language code
language_code
For a list of language codes available, you should fetch the app data, where there is an alert languages section.
Client
client
Optionally, you can indicate the name of the client application which is registering the user.
Request Example
- Headers
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept-Version: 1.19
- Body
{
"name": "John Smith Jr"
"email": "john1@nasa.com",
"phone": "(202) 358-0001"
"language_code": "fr",
"old_password": "Mypass1",
"new_password": "Mysecuredpass2"
}
Response example
If the request was successful, the response will return the full account data, just as if you did a GET request on that Account.
- Body
{
"account": {
"id": "630929_4wgkw0o0go4wco40wos4gww44tbrsluiajok04g4gsscw8wssk",
"name": "John Smith Jr",
"email": "john1@nasa.com",
"language_code": "fr",
"created_at": "2016-01-18T14:49:37.0+00:00",
"updated_at": "2016-01-18T14:49:37.0+00:00",
"grouped_email_notification": false,
"default_email_notification_frequency": "daily",
"default_desktop_notification_frequency": "hourly",
"default_push_notification_frequency": "hourly",
"default_trending_email_notification_frequency": "occasionally",
"default_trending_email_notification_frequency": "never",
"permissions": {
"create_alert": true,
"read_teammembers": true,
"read_teamrequests": true,
"read_quotastats": true
},
"email_subscriptions": {
"quota_exceeded": true
}
},
"_links": {
"self": {
"href": "\/api\/accounts\/630929_4wgkw0o0go4wco40wos4gww44tbrsluiajok04g4gsscw8wssk"
}
}
}
Id
id
An unguessable id that identifies the account across the whole API.
Grouped email notification
grouped_email_notification
Boolean value that indicates if the account prefers to have all notifications grouped in a single email for all alerts.
Links
links
A json object in which the GET url that gives access to that account can be found.