Skip to main content
Solved

Pushing Journal Transaction via API

  • 25 June 2024
  • 4 replies
  • 43 views

Hello all.

 

We have built an integration to push Journal Transactions into Acumatica with the Rest API. Our transactions can have hundreds of line items, which would come over as Transaction Details.

 

We first tried to do this within a single request. But we get this error when trying to push transactions with more than 10 details:

 

```

pAcumatica] 414 Request-URI Too Long: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Request URL Too Long</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Request URL Too Long</h2>
<hr><p>HTTP Error 414. The request URL is too long.</p>
</BODY></HTML>

```

 

We have since broken up the request into batches of 10. This also doesn’t work because the Journal Transaction will get rejected if the lines don’t balance, and the way we separate lines we can’t guarantee batches of a balanced amount.

 

I have to imagine something we’re missing with pushing transactions with large amounts of line items. Is there a way to bulk insert with the Record type?

4 replies

Userlevel 7
Badge +5

@ryanmiter you can initially insert lines into a Journal Transaction with Hold=true. That way it’ll allow you to have a batch that is not balanced and it’ll only check the balance when you set Hold=false. 

 

However, I’m not really sure why you are having the error with uploading more than 10 lines. It should allow up to 5000 lines or so. Can you provide an example of such request?

Userlevel 1
Badge

Hey Dmitrii - I ended up figuring out that the middleware we were using was sending a bad request. We ended up fixing it so now it goes through with large numbers of line items. Thanks for helping here!

 

One question I have - where do you put that “Hold=true” flag? Is it in the base body of the request or does it need to go onto the individual lines? I tried putting it into the base of the request like below but it threw an error saying it was an invalid parameter:

 

```

{"Module":{"value":"GL"},"TransactionDate":{"value":"2024-07-02T06:00:00.000"},"Description":{"value":"Off-cycle payroll for Jun 16 - 24, paid Jul 2, 2024"},"BranchID":{"value":"HEADOFFICE"},"Hold":true, “Details”: [...]}

```

 

Error message:

 

“Error reading JObject from JsonReader. Current JsonReader item is not an object: Boolean. Path 'Hold', line 1, position 202."

Userlevel 7
Badge +5

It should be "Hold": { "value": true} 

{

"Details": [
{

"Account": {
"value": "40000"
},
"CreditAmount": {
"value": 0.0000
},
"DebitAmount": {
"value": 0.0000
},

"Project": {
"value": "REVRECCO"
},
"ProjectTask": {
"value": "01TASK1"
},

"Subaccount": {
"value": "000000"
}
}
],

"LedgerID": {
"value": "ACTUAL"
},
"Module": {
"value": "GL"
},
"Hold": { "value": true}
}

 

Userlevel 1
Badge

Oh right. This should work then, thank you!

Reply