Redi
08/29/2024, 3:05 PMCeligo AI
08/29/2024, 3:06 PMAI generated answer (using internal Slack threads):Based on the conversations, to apply a customer payment to multiple invoices via the REST API, you would need to create a customer payment and then modify the apply sublist on each matching invoice. Here is an example of how you might structure the request: 1. Create or transform a customer payment:
json
POST {{REST_SERVICES}}/record/v1/customerpayment
{
"customer": {
"id": 150
},
"apply": {
"items": [
{
"amount": 368.93,
"apply": "T",
"applyDate": "2020-08-01",
"createdFrom": 4960,
"due": 368.93,
"refNum": "INV15",
"total": 368.93
}
]
}
}
2. Transform a customer to a customer payment to initialize the apply item array:
json
POST {{REST_SERVICES}}/record/v1/customer/150/!transform/customerpayment
{
"apply": {
"items": [
{
"amount": 368.93,
"apply": "T",
"applyDate": "2020-08-01",
"createdFrom": 4960,
"due": 368.93,
"refNum": "INV15",
"total": 368.93
}
]
}
}
3. Set the apply checkbox to T on the items you want to apply.
Please note that the key for items needs to match what would be on the customer payment. Also, the customer payment will have an array of items.
However, there are some issues reported with the REST API when dealing with a large number of invoices. If you encounter an error like "You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.", it might be due to the limitation of the REST API when dealing with a large number of invoices.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
08/29/2024, 3:07 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.817690492
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.809174776
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80833292
Celigo AI
08/29/2024, 3:07 PM