POST login/users/send email confirmation
Contents |
Description
Sends an email confirmation for a user given its username or e-mail.
After the call to this API, the user will receive an email with instructions to click on a link and validate his account. Each API call generates a new confirmation token, but only the last one will be valid for confirmation. Furthermore, each call will put the user in an unconfirmed state, so that he will not be able to login until his account is validated. The confirmation token lasts for 24 hours, after this period a new confirmation token must be generated by a new call to this API.
The email has a default template that allows you to configure some properties, such as the sender email, the logo url, a message and the url the user will be redirected after the confirmation.
The redirect_url is the only required parameter (along with email or username) and has two purposes. The first one is to redirect the user to your site after the email confirmation. The other is to receive a HTTP POST to inform you that this user has been confirmed. This request will be encoded in JSON format and will contain the following fields:
user_id | The user identifier. |
---|---|
confirmation_status | A boolean to inform whether the user has been confirmed or not. If the user clicks on the link after it is expired the confirmation_status will be false. Under this situation, a new call must be made to this API which will generate a new email confirmation for the user. |
The email confirmation supports two languages: English (en) and Brazilian Portuguese (pt-br). You can set the language using the HTTP header "Accept-Language".
Resource URL
POST https://api.socialidnow.com/v1/marketing/login/users/send_email_confirmation
Parameters
JSON Parameters
username 1 | optional | username |
---|---|---|
email_address 1 | optional | user e-mail |
redirect_url | required | the url to redirect the user and receive the HTTP POST |
from | optional | the sender email |
logo_url | optional | the logo url to display in the email template |
description | optional | an introductory message to the user |
1 At least one of these fields must be given to identify the user.
Authentication
This API requires Social Login App authentication. See Authentication.
Language
This API supports language configuration through HTTP "Accept-language" header. The supported languages are:
en | English (default) |
---|---|
pt-br | Brazilian Portuguese |
Response
Response Status
created (200) | The email was sent successfully. |
---|---|
bad_request (400) | Some required parameter was not informed. |
unauthorized (401) | The authentication is wrong. See Authentication. |
not_found (404) | The user was not found. |
internal_server_error (500) | An unknown error happened. |
Examples
Using username and English language
Request
curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/send_email_confirmation' \ -d '{ "username": "new_user", "redirect_url":"http://www.example.com", "from":"contact@example.com", "logo_url":"http://www.example.com/logo.png", "description":"We received a request to reset your password for Example.com account." }' \ -H 'Content-type: application/json' \ -H 'Accept-language: en' \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response
Response Headers
HTTP/1.1 200 Ok Status: 200
Using email_address and Brazilian Portuguese language
Request
curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/send_email_confirmation' \ -d '{ "email_address": "new_user@user_domain.com", "redirect_url":"http://www.example.com", "from":"contact@example.com", "logo_url":"http://www.example.com/logo.png", "description":"We received a request to reset your password for Example.com account." }' \ -H 'Content-type: application/json' \ -H 'Accept-language: pt-br' \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response
Response Headers
HTTP/1.1 200 Ok Status: 200