Actualizar suscripción a plan de ahorro
Para actualizar una suscripción a un plan de ahorro se debe realizar el siguiente request:
PATCH
/v1/savings/account-investment-plans/{account_investment_plan_id}Request
Headers
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
Authorization | string | Sí | Token de acceso en formato Bearer ACCESS_TOKEN |
Content-Type | string | Sí | Debe ser application/json |
Path Parameters
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
account_investment_plan_id | number | Sí | Identificador de la suscripción. |
No aplica: Query Parameters.
Body
El body debe enviarse en snake_case.
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
target_amount | number | No | Nuevo monto objetivo del plan. |
subscription_name | string | No | Nuevo nombre de la suscripción. |
Response
2XX Éxito
| Campo | Tipo | Descripción |
|---|---|---|
message | string | Mensaje confirmando el resultado de la operación. |
Códigos de error
Los errores devuelven el siguiente body:
{
"code": "invalid_request",
"description": "Descripción del error."
}
| Status | Code | Condición |
|---|---|---|
400 | subscription_not_found | La suscripción especificada no existe. |
403 | — | El token no tiene el rol requerido para operar este endpoint. |
Ejemplo de código
- cURL
- JavaScript
- Python
- Node.js
curl -X PATCH https://b2b.allaria.dev/v1/savings/account-investment-plans/1 \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"target_amount": 300000.00,
"subscription_name": "Plan de ahorro actualizado"
}'
const accountInvestmentPlanId = 1;
const response = await fetch(
`https://b2b.allaria.dev/v1/savings/account-investment-plans/${accountInvestmentPlanId}`,
{
method: 'PATCH',
headers: {
'Authorization': 'Bearer ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
target_amount: 300000.00,
subscription_name: 'Plan de ahorro actualizado'
})
}
);
const data = await response.json();
console.log(data);
import requests
account_investment_plan_id = 1
response = requests.patch(
f'https://b2b.allaria.dev/v1/savings/account-investment-plans/{account_investment_plan_id}',
headers={
'Authorization': 'Bearer ACCESS_TOKEN',
'Content-Type': 'application/json'
},
json={
'target_amount': 300000.00,
'subscription_name': 'Plan de ahorro actualizado'
}
)
data = response.json()
print(data)
const axios = require('axios');
const accountInvestmentPlanId = 1;
const response = await axios.patch(
`https://b2b.allaria.dev/v1/savings/account-investment-plans/${accountInvestmentPlanId}`,
{
target_amount: 300000.00,
subscription_name: 'Plan de ahorro actualizado'
},
{
headers: {
Authorization: 'Bearer ACCESS_TOKEN',
'Content-Type': 'application/json'
}
}
);
console.log(response.data);
2XX Éxito
{
"message": "Subscription updated successfully"
}