Skip to content

Modify Transaction

Request URL

POST /account/:AFiAccountId/transaction/:transactionId

Description

Makes changes to a transaction record, as long as the specified items can be changed. The account is identified by the path parameter AFiAccountId, and the transaction is identified by the path parameter transactionId.

NOTE: "account" may also be given as "accounts", and "transaction" may also be given as "transactions".

Schema

Property table for account/:AFiAccountId/transaction/:transactionId

Property Description Required Schema
AFiAccountId ampliFi ID for the account Yes {
  "type": "string"
}
transactionId transactionId Yes {
  "type": "string"
}
changes changes No changes object

Property table for changes object

Property Description Required Schema
comment Brief description or comment No {
  "type": "string",
  "nullable": true
}
labels labels No array of {
  "type": "string"
}

Request Body

{
    "changes": {
        "comment": "test123",
        "labels": ["test123"]
    }
}

Snippet Examples

javascript

const axios = require('axios');
const data = {
    "changes": {
        "comment": "test123",
        "labels": ["test123"]
    }
};
const config = {
  method: 'POST',
  url: '${AMPLIFI_BASE_URL}/account/:AFiAccountId/transaction/:transactionId',
  headers: {
    'Content-Type': "application/json",
    'token': "A long random string token received from /token request"
  },
  data
};

let result;
try {
  result = await axios.request(config);
  if (result.status === 200) {
    console.log(JSON.stringify(result.data));
  }
} catch (err) {
  console.log({
    errCode: err.code,
    responseStatus: err.response && err.response.status,
    data: err.response && JSON.stringify(err.response.data)
  });
}

cURL

curl --location "AMPLIFI_BASE_URL/account/:AFiAccountId/transaction/:transactionId" --data "{    \"changes\":{        \"comment\":\"test123\",       \"labels\":[\"test123\"]    }}" --header "Content-Type: application/json" --header "token: A long random string token received from /token request" 

Successful Response Examples

200 ACCOUNT/:AFIACCOUNTID/TRANSACTION/:TRANSACTIONID

HEADERS

Header Value
Content-Type application/json
token A long random string token received from /token request

PARAMETERS

Parameter Description Value
AFiAccountId [required] qwegalgnuyocdfoxg
transactionId [required] trn8jf5leperqkrkyioogrbukaofz

REQUEST BODY

{
    "changes": {
        "comment": "test123",
        "labels": ["test123"]
    }
}

RESPONSE BODY

{
    "success": true,
    "transaction": {} //updated transaction with the changes applied
}