The M3 REST API v1 is being retired. How to move your H5 apps and scripts to v2

· Stewart Rutledge

Infor has announced that v1 of the M3 REST API (/m3api-rest/execute) is going to be retired. That gives a lot of Infor M3 H5 apps and H5 scripts an end of life date, including every app built with Infor's standard H5 SDK tooling before March this year. Plenty of new apps are still being built on the deprecated v1 API too, simply because that's what the examples and templates use.

If your company has been running M3 in H5 for a few years, you probably have more of these than you think. This article goes through how to find them, what actually changes between v1 and v2, and three ways to migrate each one to the v2 API.

How to find H5 apps and scripts that still use the v1 API

Start with a list of everything that calls M3 from the browser or from outside M3:

  • H5 scripts. The H5 Administration tool lists the scripts that are deployed. Each one that calls an M3 API is a candidate.
  • H5 apps (SDK apps). Every app installed in H5 calls M3 APIs, so all of them belong on the list.
  • Integrations. Anything that calls M3 through the ION API gateway with the same REST endpoints, like a web shop, a scanner app or a reporting tool.

Then check each one. The v1 API answers at /m3api-rest/execute/<program>/<transaction>. The v2 API answers at /m3api-rest/v2/execute. If you have the source, searching it for m3api-rest tells you which one it calls. In apps built on Infor's SDK, the SDK version the app was built with decides it, so note that version down as well.

A script or app you can't find the source for is not a dead end. M3 keeps the compiled JavaScript of every deployed script, and that's enough to tell what it calls (and, as you'll see below, enough to rebuild it).

What changes between M3 API v1 and v2

For a single call, the difference is mostly in how the request and the response are shaped. v1 takes the program, transaction and fields in the URL and answers one transaction at a time. v2 takes a request body with a list of transactions and answers with a result for each one, including its own error if it failed. One failing transaction doesn't stop the others.

That last part is the real reason to be glad about the move. v2 can run many transactions in one request, which v1 can't. An app that loads stock for every item in every warehouse can do it in a handful of requests instead of tens of thousands, and that's the difference between a screen that opens in a second and one that freezes the browser.

Three ways to migrate to the v2 API

Which one fits depends on what you still have.

1. You have the source, and someone who knows it

Update the calls. For an H5 script that's usually a small change: swap the request, then adjust the code that reads the response. For an app it's often an SDK upgrade, which on an older app tends to drag an Angular upgrade along with it. That part is the expensive one.

2. You only have what's deployed in M3

This is more common than anyone likes to admit. The developer has moved on, the source was on a laptop, and all that's left is the compiled script in M3.

You can rebuild from that. We took a script written in 2021 against the v1 API, exported the compiled JavaScript from M3 and had Loupe Code rebuild it as TypeScript using v2. It took less than a minute and cost a little under €1. The result is source you own and can keep in your own repository, so the next change doesn't start from zero again.

3. An old H5 app with outdated libraries

Here you have two choices.

  • Adopt the app. Keep the app as it is and bring it up to date: newer libraries, v2 for every M3 call, and a working build. The screens, the behaviour and the look stay the same. In Loupe Code that's Import existing: you give it the app's folder or a zip, it checks and builds the app, and from then on you change it by describing the change. We've done this with a six year old app.
  • Rebuild it. Use the old app as the reference for a new one built with current tooling. Loupe Code reads the old app to understand what it does rather than copying its code. It's the better choice when the app needs changes anyway, and you'll often fix a few things on the backlog along the way.

A plan that works

  1. Make the list of scripts, apps and integrations, and note which API version each one uses.
  2. Rank them by use. A script on OIS100 that every order desk user runs comes before an app two people open once a month.
  3. Find the source for each one, or note that you don't have it.
  4. Pick a way for each: update, rebuild from what's deployed, adopt, or rebuild from scratch.
  5. Test against your own M3 before anything is deployed, and keep the new source in your own repository.

Questions we get

Does this affect XtendM3 extensions?
No. Extensions run inside M3 and call M3 APIs through XtendM3's own interface, not through the REST API.

Do I need to do it right away?
You need to be done before the retirement date Infor gives you. Since every app on the list needs testing, starting with the inventory now is the easy part to get out of the way.

What about apps we bought from a partner?
Ask the partner which API version they use and when they'll move. Everything we build at Beredo, by hand or with Loupe Code, already uses v2.

If you have an old script or app you're not sure about, send it our way and we'll show you what moving it looks like. Reach out at hello@loupeapp.net, or read more about Loupe Code.

This article started as a post on LinkedIn. Join the conversation there.

Got something on your M3 backlog?

Send it our way and we'll show you what Loupe Code does with it, on your own M3.

The M3 REST API v1 is being retired. How to move your H5 apps and scripts to v2