Update user
curl --request PUT \
--url https://cashboard-f5x2.onrender.com/user/{id} \
--header 'Content-Type: application/json' \
--data '
{
"currency": "KSH"
}
'import requests
url = "https://cashboard-f5x2.onrender.com/user/{id}"
payload = { "currency": "KSH" }
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({currency: 'KSH'})
};
fetch('https://cashboard-f5x2.onrender.com/user/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cashboard-f5x2.onrender.com/user/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'currency' => 'KSH'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cashboard-f5x2.onrender.com/user/{id}"
payload := strings.NewReader("{\n \"currency\": \"KSH\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://cashboard-f5x2.onrender.com/user/{id}")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"KSH\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cashboard-f5x2.onrender.com/user/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"currency\": \"KSH\"\n}"
response = http.request(request)
puts response.read_body{
"_id": "65c9bd409983f403ed82f194",
"username": "michellem",
"email": "michelle.muthoni@gmail.com",
"password": "$2a$10$yjp6lyCU6.jwQrhOG/7kjOhnYHR3dyh4t8EkdoC3np9IZstHoiXiC",
"currency": "USD",
"accounts": [],
"income": [],
"expenses": [],
"savings": [],
"investments": [],
"reports": [],
"__v": 0
}{
"status": "error",
"message": "The user could not be updated"
}Users
Update user
This endpoint is used to update the user’s details.
Endpoint: https://cashboard-f5x2.onrender.com/user/:id
Path Parameter: User’s UUID
It can be used to update:
- currency (string) - the user’s preferred currency
- email address (string)
- username (string)
- password (string)
This endpoint can not be used to update the user’s accounts, expenses, income, savings and investments.
PUT
/
user
/
{id}
Update user
curl --request PUT \
--url https://cashboard-f5x2.onrender.com/user/{id} \
--header 'Content-Type: application/json' \
--data '
{
"currency": "KSH"
}
'import requests
url = "https://cashboard-f5x2.onrender.com/user/{id}"
payload = { "currency": "KSH" }
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({currency: 'KSH'})
};
fetch('https://cashboard-f5x2.onrender.com/user/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cashboard-f5x2.onrender.com/user/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'currency' => 'KSH'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cashboard-f5x2.onrender.com/user/{id}"
payload := strings.NewReader("{\n \"currency\": \"KSH\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://cashboard-f5x2.onrender.com/user/{id}")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"KSH\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cashboard-f5x2.onrender.com/user/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"currency\": \"KSH\"\n}"
response = http.request(request)
puts response.read_body{
"_id": "65c9bd409983f403ed82f194",
"username": "michellem",
"email": "michelle.muthoni@gmail.com",
"password": "$2a$10$yjp6lyCU6.jwQrhOG/7kjOhnYHR3dyh4t8EkdoC3np9IZstHoiXiC",
"currency": "USD",
"accounts": [],
"income": [],
"expenses": [],
"savings": [],
"investments": [],
"reports": [],
"__v": 0
}{
"status": "error",
"message": "The user could not be updated"
}Path Parameters
required
Body
application/json
The body is of type object.
Response
OK
The response is of type object.

