jbaanm
20th April 2016, 10:11
How to create my OWN API enabled libraries?
I want to create a set of new functions on custom tables which can be used by other as API calls.
Is it just going to be normal library or we need additional coding there?

Thanks

Jay

bhushanchanda
20th April 2016, 11:17
Hi,

What are the other API's which are going to use it? A general library with multiple extern functions will help you creating your own API. The usage depends on how you are going to call them.

mark_h
20th April 2016, 17:48
Like Bhusan said it depends on how you are calling them. A simple DLL in 4c4 and I can call it from excel. Have not even looked at it in a long time. You can search for other ways people call libraries in this forum - using C++, VBasic, etc. Several methods are available.

jbaanm
22nd April 2016, 14:16
Thanks all.

I created a Library and it has one function like get.inventory(Item, warehouse as Parameter)

Now how they will call it? Do I need to have a session so they can call it using API handler. Example external code for when they use a normal API function stpapi.put.field and stpapi.get.field in Library ottstpapihand

BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(\"tdslsc505m000\",\"item\",\"" + item.ItemCode + "\")");
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(\"tdslsc505m000\",\"qana\",\"" + item.Quantity + "\")");
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(\"tdslsc505m000\",\"uset\",\"1\")");
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.continue.process(\"tdslsc505m000\",\"" + buffer + "\")");

bhushanchanda
22nd April 2016, 14:42
Hi,

Not sure this is a way I would do it. Instead, you can create a DLL and add a function to it with multiple parameters. The DLL will perform the AFS when executed using the parameters.

Now, you just need to call the DLL with the required parameters.

Here's an example -

Thread (http://www.baanboard.com/baanboard/showthread.php?t=64202) -> Code (http://www.baanboard.com/baanboard/showpost.php?p=182493&postcount=2)