Create an Income Source
curl --request POST \
--url https://cashboard-f5x2.onrender.com/income/add \
--header 'Content-Type: application/json' \
--data '
{
"source": "Side Hustle: Selling Shoes",
"payDate": "11/02/2024",
"category": "side hustle",
"account": "662fbf9eac827e370c18d4b9",
"amount": "7000"
}
'import requests
url = "https://cashboard-f5x2.onrender.com/income/add"
payload = {
"source": "Side Hustle: Selling Shoes",
"payDate": "11/02/2024",
"category": "side hustle",
"account": "662fbf9eac827e370c18d4b9",
"amount": "7000"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
source: 'Side Hustle: Selling Shoes',
payDate: '11/02/2024',
category: 'side hustle',
account: '662fbf9eac827e370c18d4b9',
amount: '7000'
})
};
fetch('https://cashboard-f5x2.onrender.com/income/add', 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/income/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => 'Side Hustle: Selling Shoes',
'payDate' => '11/02/2024',
'category' => 'side hustle',
'account' => '662fbf9eac827e370c18d4b9',
'amount' => '7000'
]),
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/income/add"
payload := strings.NewReader("{\n \"source\": \"Side Hustle: Selling Shoes\",\n \"payDate\": \"11/02/2024\",\n \"category\": \"side hustle\",\n \"account\": \"662fbf9eac827e370c18d4b9\",\n \"amount\": \"7000\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://cashboard-f5x2.onrender.com/income/add")
.header("Content-Type", "application/json")
.body("{\n \"source\": \"Side Hustle: Selling Shoes\",\n \"payDate\": \"11/02/2024\",\n \"category\": \"side hustle\",\n \"account\": \"662fbf9eac827e370c18d4b9\",\n \"amount\": \"7000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cashboard-f5x2.onrender.com/income/add")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": \"Side Hustle: Selling Shoes\",\n \"payDate\": \"11/02/2024\",\n \"category\": \"side hustle\",\n \"account\": \"662fbf9eac827e370c18d4b9\",\n \"amount\": \"7000\"\n}"
response = http.request(request)
puts response.read_body{
"income": [
{
"source": "Side Hustle: Selling Shoes",
"payDate": "2024-11-02T00:00:00.000Z",
"account": "662fbf9eac827e370c18d4b9",
"category": "side hustle",
"amount": 7000,
"_id": "662fbfcaac827e370c18d4bf"
}
]
}{
"status": "error",
"message": "Income not added"
}Income
Create an Income Source
This endpoint creates an income source for the specified user.
The details that should be specified in the request body are:
- the income source (string) - the income’s description
- the payDate (date) - the date the income was paid
- the category (string) - the category of the income
- the account’s id (string) - the account that was credited
- the amount (number) - the amount made from the income source
When you’re withdrawing from an investment, you can use this endpoint by assigning the investment ID to the income source. This will ensure the amount is deducted from the investment and credited to the account.
The response body is a JSON object that includes an array of all the user’s income sources. The individual income object contains:
- the income source (string) - the income’s description
- the payDate (date) - the date the income was paid
- the category (string) - the category of the income
- the account’s id (string) - the account that was credited
- the amount (number) - the amount made from the income source
- _id (string) - the unique identifier for the income
POST
/
income
/
add
Create an Income Source
curl --request POST \
--url https://cashboard-f5x2.onrender.com/income/add \
--header 'Content-Type: application/json' \
--data '
{
"source": "Side Hustle: Selling Shoes",
"payDate": "11/02/2024",
"category": "side hustle",
"account": "662fbf9eac827e370c18d4b9",
"amount": "7000"
}
'import requests
url = "https://cashboard-f5x2.onrender.com/income/add"
payload = {
"source": "Side Hustle: Selling Shoes",
"payDate": "11/02/2024",
"category": "side hustle",
"account": "662fbf9eac827e370c18d4b9",
"amount": "7000"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
source: 'Side Hustle: Selling Shoes',
payDate: '11/02/2024',
category: 'side hustle',
account: '662fbf9eac827e370c18d4b9',
amount: '7000'
})
};
fetch('https://cashboard-f5x2.onrender.com/income/add', 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/income/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => 'Side Hustle: Selling Shoes',
'payDate' => '11/02/2024',
'category' => 'side hustle',
'account' => '662fbf9eac827e370c18d4b9',
'amount' => '7000'
]),
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/income/add"
payload := strings.NewReader("{\n \"source\": \"Side Hustle: Selling Shoes\",\n \"payDate\": \"11/02/2024\",\n \"category\": \"side hustle\",\n \"account\": \"662fbf9eac827e370c18d4b9\",\n \"amount\": \"7000\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://cashboard-f5x2.onrender.com/income/add")
.header("Content-Type", "application/json")
.body("{\n \"source\": \"Side Hustle: Selling Shoes\",\n \"payDate\": \"11/02/2024\",\n \"category\": \"side hustle\",\n \"account\": \"662fbf9eac827e370c18d4b9\",\n \"amount\": \"7000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cashboard-f5x2.onrender.com/income/add")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": \"Side Hustle: Selling Shoes\",\n \"payDate\": \"11/02/2024\",\n \"category\": \"side hustle\",\n \"account\": \"662fbf9eac827e370c18d4b9\",\n \"amount\": \"7000\"\n}"
response = http.request(request)
puts response.read_body{
"income": [
{
"source": "Side Hustle: Selling Shoes",
"payDate": "2024-11-02T00:00:00.000Z",
"account": "662fbf9eac827e370c18d4b9",
"category": "side hustle",
"amount": 7000,
"_id": "662fbfcaac827e370c18d4bf"
}
]
}{
"status": "error",
"message": "Income not added"
}Query Parameters
required
Body
application/json
The body is of type object.
Response
Created
The response is of type object.

