I’m new to the forum, so apologies if this is in the wrong area [emoticon:c4563cd7d5574777a71c318021cbbcc8]
I need to post a Item reclass/ item journal via the NAV API. (I’m using oData to currently add entries to the journal, oData doesn’t seem to be able to actually “post” it [emoticon:ca08b2c27c2f40e993e89508acf29e0b].
I’ve found POST http://://api/beta/companies({id})/journals({id})/Microsoft.NAV.post on the NAV api docs online.
I’m not sure how the request should be sent through code as I’ve previously just used the oData service, also I’m not sure what needs passing through as the {id} as the journal batches don’t seem to have an actual “id” of any kind.
Any help would be massively appreciated as I’ve been stuck on this for days [emoticon:ca08b2c27c2f40e993e89508acf29e0b]
Not sure why you create your data using Odata and SOAP… Odata is mainly used for pulling data using Microsoft Excel/Power BI Desktop from Dynamics NAV/365bc.
The way to post a journal is to create a new Codeunit with the code at takes your created journal and posts its - You can create that Codeunit in less than 10 coding lines.
Hi [mention:74275055534c437ab13054c27a1ed5fb:e9ed411860ed4f2ba0265705b8793d05], thanks for the reply.
In honesty, I’ve only really used HttpClient before for API calls, and saw a document somewhere on the web saying to use oData (Sorry, can’t remember where). oData has turned out to be really good so far, but I can see it’s only really good for “basic” tasks with entities and queries.
Yes, I’ve hear about custom code units before, but we get our NAV package through a 3rd party so can’t access the Dev tools to create the code unit (I’ve been in contact with them to double check this)
Currently waiting on a quote from our partner on how much it would be for them to create the Code unit for us, I was just wondering if there was another method I wasn’t aware of.
Well, one of the most cool things about NAV/365 BC is the option of being able to change it… So you should demand some assistance in this. As I said it is only approx 10 lines of code to do it, and the price of the object is EUR 10-20 so it would be a shame not to solve your issue.
Is there a code unit I can call that already exists to post the journal? - I’ve heard a lot of people mention code unit 23, but it doesn’t seem to have any kind of “post” method attached to it.
Also, any chance of a quick code snippet of a method you have used to connect to a code unit, just to make sure I’m, on the right track?