post__settings_user
POST /settings/user
Update User Settings (Full Replacement)
Update the current user's settings with a complete replacement. This endpoint replaces all existing settings with the provided settings object. The user must be authenticated.
Request Body Schema
» settings
object
true
none
Complete settings object to replace existing settings
TypeScript Client Library
// Using the Flashback TypeScript client
import { FlashbackClient } from '@flashback/client';
const client = new FlashbackClient({
accessToken: 'your-access-token'
});
// Update user settings with full replacement
try {
const result = await client.settings.user.update({
settings: {
theme: 'dark',
notifications: {
email: true,
push: false
},
timezone: 'UTC',
language: 'en'
}
});
console.log('Settings updated:', result);
} catch (error) {
console.error('Failed to update settings:', error);
}Code Samples
# You can also use wget
curl -X POST https://backend.flashback.tech/settings/user \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
-H 'Content-Type: application/json' \
-d '{
"settings": {
"theme": "dark",
"notifications": {
"email": true,
"push": false
},
"timezone": "UTC",
"language": "en"
}
}'POST https://backend.flashback.tech/settings/user HTTP/1.1
Host: localhost:3000
Accept: application/json
Authorization: Bearer {access-token}
Content-Type: application/json
{
"settings": {
"theme": "dark",
"notifications": {
"email": true,
"push": false
},
"timezone": "UTC",
"language": "en"
}
}const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}',
'Content-Type':'application/json'
};
const body = {
"settings": {
"theme": "dark",
"notifications": {
"email": true,
"push": false
},
"timezone": "UTC",
"language": "en"
}
};
fetch('https://backend.flashback.tech/settings/user',
{
method: 'POST',
headers: headers,
body: JSON.stringify(body)
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
'Content-Type' => 'application/json'
}
body = {
"settings" => {
"theme" => "dark",
"notifications" => {
"email" => true,
"push" => false
},
"timezone" => "UTC",
"language" => "en"
}
}
result = RestClient.post 'https://backend.flashback.tech/settings/user',
body.to_json, headers: headers
p JSON.parse(result)import requests
import json
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}',
'Content-Type': 'application/json'
}
body = {
"settings": {
"theme": "dark",
"notifications": {
"email": True,
"push": False
},
"timezone": "UTC",
"language": "en"
}
}
r = requests.post('https://backend.flashback.tech/settings/user',
headers=headers,
data=json.dumps(body))
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
'Content-Type' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array(
'settings' => array(
'theme' => 'dark',
'notifications' => array(
'email' => true,
'push' => false
),
'timezone' => 'UTC',
'language' => 'en'
)
);
try {
$response = $client->request('POST','https://backend.flashback.tech/settings/user', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}URL obj = new URL("https://backend.flashback.tech/settings/user");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Authorization", "Bearer {access-token}");
con.setRequestProperty("Content-Type", "application/json");
String jsonInputString = "{\"settings\":{\"theme\":\"dark\",\"notifications\":{\"email\":true,\"push\":false},\"timezone\":\"UTC\",\"language\":\"en\"}}";
con.setDoOutput(true);
try(OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
"Content-Type": []string{"application/json"},
}
body := map[string]interface{}{
"settings": map[string]interface{}{
"theme": "dark",
"notifications": map[string]interface{}{
"email": true,
"push": false,
},
"timezone": "UTC",
"language": "en",
},
}
jsonData, _ := json.Marshal(body)
data := bytes.NewBuffer(jsonData)
req, err := http.NewRequest("POST", "https://backend.flashback.tech/settings/user", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}Example responses
200 Response
{
"success": true,
"message": "User settings updated successfully"
}400 Response
{
"success": false,
"message": "Failed to update user settings"
}500 Response
{
"success": false,
"message": "Internal server error",
"error": "Database connection failed"
}Responses
Response Schema
Status Code 200
» success
boolean
true
none
Indicates if the request was successful
» message
string
true
none
Success message describing the operation
Status Code 400
» success
boolean
true
none
Always false for error responses
» message
string
true
none
Error message describing the issue
Status Code 500
» success
boolean
true
none
Always false for error responses
» message
string
true
none
Error message describing the issue
» error
string
false
none
Additional error details if available
DTOs
UpdateSettingsRequest
export interface UpdateSettingsRequest {
// Using Record<string, any> for maximum flexibility - settings can contain any JSON-serializable data
settings: Record<string, any>;
}SettingsErrorResponse
export interface SettingsErrorResponse {
success: false;
message: string;
error?: string;
}Last updated
Was this helpful?