This document provides guidelines on using the set_customer_password_reset_request
endpoint for resetting a customer's password in the API server's database. This endpoint facilitates automatic password reset and communicates the new password to the customer via email.
This API call is designed to streamline the process of resetting a customer's password, ensuring a quick and secure way to regain access to their account.
To reset a customer's password, use the set_customer_password_reset_request
API call. The process involves verifying API credentials and the customer's email address, followed by the automatic creation of a new password.
https://easycms.fi/public_api/set_customer_password_reset_request/
For a successful password reset, the following parameters are mandatory:
TOKEN (api_key)
: Your unique API key for authentication.username
: Your login username.password
: Your login password.account
: Your specific account ID.email
: The email address of the customer who is requesting a password reset.Once the password reset request is made, the system performs the following actions:
curl -X POST 'https://easycms.fi/public_api/set_customer_password_reset_request' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&email=customer@mail.com'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://easycms.fi/public_api/set_customer_password_reset_request",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query(['username' => 'USERNAME', 'password' => 'PASSWORD', 'account' => 'ACCOUNT_ID', 'email' => 'customer@mail.com']),
CURLOPT_HTTPHEADER => array("Authorization1: TOKEN"),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://easycms.fi/public_api/set_customer_password_reset_request"
headers = {"Authorization1": "TOKEN"}
payload = {'username': 'USERNAME', 'password': 'PASSWORD', 'account': 'ACCOUNT_ID', 'email': 'customer@mail.com'}
response = requests.post(url, headers=headers, data=payload)
print(response.text)
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://easycms.fi/public_api/set_customer_password_reset_request"))
.headers("Authorization1", "TOKEN")
.POST(HttpRequest.BodyPublishers.ofString("username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&email=customer@mail.com"))
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
const https = require('https');
const data = new URLSearchParams({
username: 'USERNAME',
password: 'PASSWORD',
account: 'ACCOUNT_ID',
email: 'customer@mail.com'
}).toString();
const options = {
hostname: 'prolasku.fi',
path: '/public_api/set_customer_password_reset_request',
method: 'POST',
headers: {
'Authorization1': 'TOKEN',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length
}
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => { data += chunk; });
res.on('end', () => { console.log(data); });
});
req.on('error', (e) => { console.error(e); });
req.write(data);
req.end();
import React, { useEffect, useState } from 'react';
function App() {
const [responseText, setResponseText] = useState('');
useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch('https://easycms.fi/public_api/set_customer_password_reset_request', {
method: 'POST',
headers: {'Authorization1': 'TOKEN', 'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({username: 'USERNAME', password: 'PASSWORD', account: 'ACCOUNT_ID', email: 'customer@mail.com'}).toString()
});
const data = await response.text();
setResponseText(data);
} catch (error) {
console.error(error);
}
};
fetchData();
}, []);
return ({responseText});
}
export default App;
// Kotlin example requires using a third-party library like OkHttp for POST requests with a body
// Kotlin Example using OkHttp for POST request
import okhttp3.OkHttpClient
import okhttp3.FormBody
import okhttp3.Request
fun main() {
val client = OkHttpClient()
val formBody = FormBody.Builder()
.add("username", "USERNAME")
.add("password", "PASSWORD")
.add("account", "ACCOUNT_ID")
.add("email", "customer@mail.com")
.build()
val request = Request.Builder()
.url("https://easycms.fi/public_api/set_customer_password_reset_request")
.post(formBody)
.addHeader("Authorization1", "TOKEN")
.build()
client.newCall(request).execute().use { response ->
if (!response.isSuccessful) throw IOException("Unexpected code $response")
println(response.body?.string())
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var token = "TOKEN";
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair("username", "USERNAME"),
new KeyValuePair("password", "PASSWORD"),
new KeyValuePair("account", "ACCOUNT_ID"),
new KeyValuePair("email", "customer@mail.com")
});
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add("Authorization1", token);
var response = await httpClient.PostAsync("https://easycms.fi/public_api/set_customer_password_reset_request", content);
if (response.IsSuccessStatusCode)
{
var responseData = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseData);
}
else
{
Console.WriteLine($"Error: {response.StatusCode}");
}
}
}
}
When you make a request to the endpoint, you receive a JSON response containing various keys and values. Here's an explanation of the response keys and their meanings:
{
"INFO": {
"start": 0,
"limit": 1,
"count": 1,
"total_count": 1,
"tip": "The data was stored into the system!"
},
"OUTPUT": {
"response_type": "success",
"message": "Password was reset and sent to user's email address"
}
}
Here are the possible error messages and their meanings:
UN-AUTHORIZED - _user_name_password_is_set_but_wrong_value!
: Incorrect username or password.email_is_not_valid
: Incorrect email format or email does not exist or email server not responding based on API server's email verification module.this_account_does_not_exist_or_your_credentials_do_not_match_this_account
: The account doesn't exist or mismatched credentials.UN-AUTHORIZED - header is set but the header value is not correct!
: Incorrect authorization header value.Maximum query size is 1 rows per query
: Exceeded maximum limit of 1 rows per query.