Like any kid with a new toy, I find it a little hard to resist having a play – so this evening I decided that I would expand my mind with research and experimentation… J

I had a quick look through the H5 Development Guide and discovered that it is a little thin on information – infact it’s very similar to the M3 Smart Office development guide – but it provides us with some clues about what we can do.

And in this instance, I was wondering how hard it would be to call the M3 APIs from within the Javascript as this is something I do for many customers scripts and I was wondering if I would need to pass authentication information. As it turns out, once I stopped trying to work with a broken API , it’s pretty simple as we can examine the H5 generated code to get some good clues about how it works.

So what I’ll do is show you the process that I went through and some example code – I haven’t got a nice code pattern, and I haven’t really done much on web development so apologies in advance…

I decided to use IE, it has some nice debugging tools. So I went in to the H5 client and opened OIS300, then like I’m sure 90% of people (I’m sure), I opened the developer tools

Which gave me something like this. The DOM Explorer being very interesting as I could start looking at how the webpage was constructed. Scrolling down I noted some M3 REST calls to the APIs, specifically MNS410MI.LstRoles

And I found the apiBaseUrl further up the document

So now I had a method to call the APIs – but processing them, well…I didn’t really have the time or inclination to search the web, so scanning through the code in the DOM explorer I found the function getCustomizationRoles referenced a couple of screenshots above.

So now we have the code to process the returned API results.

I wrote a little code to ensure that the nameValue[j].Name related to the field name returned from the API and the nameValue[j].Value is the actual value – which it was.

Now that we have some useful information and I moved on to call a simple API, CRS008MI.ListFacility – it will list the facilities, and if you supply a facility it will list the facilities from that point onwards. Something nice and easy.

I also wanted to present the information in one of the H5 pop up dialogs – which is helpfully documented in the H5 Development Guide.

The result is this:

And the code (it needs to be saved as sacTest.js and you need to associate it to a panel as sacTest):

3 Responses to M3 API Calls with the H5 Client

Hello. My name is Mathieu Bourcet.
I am developer H5 / javascript with Mr Kham for 3klesConsulting.
I am contacting you on behalf of Thibaut. I encounter a problem with javascript / mashup, indeed I must update the headers of a Mashup list with data from a screen F. My problem is that I do not find the option to retrieve the instance of the mashup in javascipt code.
I manage to store the values of the screen ‘F’ in variable but I can not seem to inject it into the Mashup List. The mashup of the list must be positioned on the variable. Do you have an idea or example on this.
Thank you

from your browser if you enable the developer mode, you should be able to inspect the code that makes up the page that the mashup is on. It may should provide some clues as to the object names which will allow you to manipulate the mashup.

I haven’t had enough of a play with the H5 client to offer much more advice, sorry.