Create spending plan iteration item
curl --request POST \
--url https://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"planned_amount": 110,
"category_guid": "CAT-40faf068-abb4-405c-8f6a-e883ed541fff",
"item_type": 1,
"scheduled_payment_guid": "SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b",
"top_level_category_guid": "CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8"
}
'import requests
url = "https://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items"
payload = {
"planned_amount": 110,
"category_guid": "CAT-40faf068-abb4-405c-8f6a-e883ed541fff",
"item_type": 1,
"scheduled_payment_guid": "SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b",
"top_level_category_guid": "CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
planned_amount: 110,
category_guid: 'CAT-40faf068-abb4-405c-8f6a-e883ed541fff',
item_type: 1,
scheduled_payment_guid: 'SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b',
top_level_category_guid: 'CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8'
})
};
fetch('https://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items', 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://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items",
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([
'planned_amount' => 110,
'category_guid' => 'CAT-40faf068-abb4-405c-8f6a-e883ed541fff',
'item_type' => 1,
'scheduled_payment_guid' => 'SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b',
'top_level_category_guid' => 'CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items"
payload := strings.NewReader("{\n \"planned_amount\": 110,\n \"category_guid\": \"CAT-40faf068-abb4-405c-8f6a-e883ed541fff\",\n \"item_type\": 1,\n \"scheduled_payment_guid\": \"SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b\",\n \"top_level_category_guid\": \"CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"planned_amount\": 110,\n \"category_guid\": \"CAT-40faf068-abb4-405c-8f6a-e883ed541fff\",\n \"item_type\": 1,\n \"scheduled_payment_guid\": \"SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b\",\n \"top_level_category_guid\": \"CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"planned_amount\": 110,\n \"category_guid\": \"CAT-40faf068-abb4-405c-8f6a-e883ed541fff\",\n \"item_type\": 1,\n \"scheduled_payment_guid\": \"SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b\",\n \"top_level_category_guid\": \"CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8\"\n}"
response = http.request(request)
puts response.read_body{
"actual_amount": 345,
"category_guid": "CAT-40faf068-abb4-405c-8f6a-e883ed541fff",
"created_at": "2016-10-13T18:08:00+00:00",
"guid": "SPL-e5f9a5bd-c5b3-4901-bdc0-62119b9db262",
"item_type": "1",
"planned_amount": 110,
"scheduled_payment_guid": "SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b",
"spending_plan_iteration_guid": "SPI-848e6648-3fa3-4632-ac8f-e65f03167102",
"top_level_category_guid": "CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8",
"transaction_guids": [
"TRN-265abee9-889b-af6a-c69b-25157db2bdd9"
],
"updated_at": "2016-10-13T18:09:00+00:00",
"user_guid": "USR-fa7537f3-48aa-a683-a02a-b18940482f54"
}Spending Plans
Create spending plan iteration item
POST
/
users
/
{user_guid}
/
spending_plans
/
{spending_plan_guid}
/
iterations
/
current
/
iteration_items
Create spending plan iteration item
curl --request POST \
--url https://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"planned_amount": 110,
"category_guid": "CAT-40faf068-abb4-405c-8f6a-e883ed541fff",
"item_type": 1,
"scheduled_payment_guid": "SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b",
"top_level_category_guid": "CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8"
}
'import requests
url = "https://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items"
payload = {
"planned_amount": 110,
"category_guid": "CAT-40faf068-abb4-405c-8f6a-e883ed541fff",
"item_type": 1,
"scheduled_payment_guid": "SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b",
"top_level_category_guid": "CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
planned_amount: 110,
category_guid: 'CAT-40faf068-abb4-405c-8f6a-e883ed541fff',
item_type: 1,
scheduled_payment_guid: 'SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b',
top_level_category_guid: 'CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8'
})
};
fetch('https://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items', 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://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items",
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([
'planned_amount' => 110,
'category_guid' => 'CAT-40faf068-abb4-405c-8f6a-e883ed541fff',
'item_type' => 1,
'scheduled_payment_guid' => 'SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b',
'top_level_category_guid' => 'CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items"
payload := strings.NewReader("{\n \"planned_amount\": 110,\n \"category_guid\": \"CAT-40faf068-abb4-405c-8f6a-e883ed541fff\",\n \"item_type\": 1,\n \"scheduled_payment_guid\": \"SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b\",\n \"top_level_category_guid\": \"CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"planned_amount\": 110,\n \"category_guid\": \"CAT-40faf068-abb4-405c-8f6a-e883ed541fff\",\n \"item_type\": 1,\n \"scheduled_payment_guid\": \"SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b\",\n \"top_level_category_guid\": \"CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://int-api.mx.com/users/{user_guid}/spending_plans/{spending_plan_guid}/iterations/current/iteration_items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"planned_amount\": 110,\n \"category_guid\": \"CAT-40faf068-abb4-405c-8f6a-e883ed541fff\",\n \"item_type\": 1,\n \"scheduled_payment_guid\": \"SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b\",\n \"top_level_category_guid\": \"CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8\"\n}"
response = http.request(request)
puts response.read_body{
"actual_amount": 345,
"category_guid": "CAT-40faf068-abb4-405c-8f6a-e883ed541fff",
"created_at": "2016-10-13T18:08:00+00:00",
"guid": "SPL-e5f9a5bd-c5b3-4901-bdc0-62119b9db262",
"item_type": "1",
"planned_amount": 110,
"scheduled_payment_guid": "SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b",
"spending_plan_iteration_guid": "SPI-848e6648-3fa3-4632-ac8f-e65f03167102",
"top_level_category_guid": "CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8",
"transaction_guids": [
"TRN-265abee9-889b-af6a-c69b-25157db2bdd9"
],
"updated_at": "2016-10-13T18:09:00+00:00",
"user_guid": "USR-fa7537f3-48aa-a683-a02a-b18940482f54"
}This endpoint creates a new
spending_plan_iteration_item.Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Path Parameters
The unique ID for the spending_plan.
The unique identifier for a user, beginning with the prefix USR-.
Body
application/json
Iteration item to be created with required parameter (planned_amount)
Response
200 - application/vnd.mx.api.v1+json
OK
Example:
345
Example:
"CAT-40faf068-abb4-405c-8f6a-e883ed541fff"
Example:
"2016-10-13T18:08:00+00:00"
Example:
"SPL-e5f9a5bd-c5b3-4901-bdc0-62119b9db262"
Example:
"1"
Example:
110
Example:
"SCP-c731988a-712f-4f83-9b3b-0aa5b3d5208b"
Example:
"SPI-848e6648-3fa3-4632-ac8f-e65f03167102"
Example:
"CAT-9588eaad-90a4-bb5c-66c8-1812503d0db8"
Example:
"TRN-265abee9-889b-af6a-c69b-25157db2bdd9"
Example:
"2016-10-13T18:09:00+00:00"
Example:
"USR-fa7537f3-48aa-a683-a02a-b18940482f54"

