Publish a CodeUnit as REST

Hi everyone,

A simple question. Is it possible to publish a CodeUnit like a REST api into NAV 2018? Or just liek SOAP?

Thank you!

Hi,

Codeunits can only be published as SOAP web services, and I suppose it was done on purpose. The problem is in maintaining compliance with REST constraints when publishing codeunits. You can wrap a NAV codeunit in an OData request, but you can’t make it RESTful. Seems, in BC, Microsoft suggested a workaround by allowing bound actions in pages (not sure, though, how it conforms with REST principles).

Hi Alexander,

As you’ve said, codeunits can be just published as SOAP. The only way to publish somehing as REST, must be pages ior query, with the oData URL

This is finally harder than I thought at frist time…

I created a simple page, related to the item table. A few fields where calculated into functions in that page, and everything was correct sending all the items.

But everything has changed. The outsider app is requesting a page number and page size, that I understand those should be parameters in the REST call.

For example, I have 4000 items into databes. I receive page : 4, and pagesize:20, so I must return items 61-80…

How can be thios done? is it possible with a publishd page? And the request pages?

Must say I’m using NAV2018…

THnak you all