top of page

How to write your first API with AlchemyJ

Updated: Apr 17, 2020

This tutorial is going to start you off on how to use AlchemyJ as a tool to build your business model and turn it into API afterward.

In this tutorial, we are going to create our first REST API using AlchemyJ. We will create an API that can perform a simple greeting operation called Say Hello.

Let's begin with launching Microsoft Excel, from here select the AlchemyJ toolbar in ribbon menu bar(next to Help). Then we will select New Model and select the REST API Sample Model.

AJ Toolbar
AJ Toolbar
New model and model selection
New model and model selection

Save this new excel file as SayHello.xlsm. Please ensure "Excel Macro-Enabled Worksheet" is selected as the file type when you save.

The default template of AlchemyJ REST API sample model will have multiple tabs open. For the API we need to build, we just need to focus on BizLogic tab.

Take some time to read the instruction on the Instruction tab. It'll also provide you better understanding on how to use the sample model.

In BizLogic tab, the cell next to Input Parameter 1 will be the input field. This input field is where we input name of the person we are greeting. We will leave this as default

Now for the cell next to Function Result, we will need change the current formula to a greeting that looks something like this.

Hello Raymond, now is 12:01:02

*assuming the input in B1 is RAYMOND

Give it a go before you compare your formula with mine. All this can be achieved with standard excel formula.

Once you have tried, compare your formula with mine.

="Hello " & PROPER(B1) & ", now is " & TEXT(NOW(), "hh:mm:ss")

Let me know in comment if there's better way to do it or if yours is different.

Now that we have complete the formula, let's try the function if it's working on our excel model. First we provide them with input in the cell next to Input Parameter 1.

In my case, I'll use my own name "RAYMOND TAM". We will type everything in CAPS so that the function will help convert it to proper format.

Then select the Run Function Point then select Function Point 1.

You should get result on both cell B2 and A6 that show's the below.

Hello Raymond Tam, now is 12:01:02

Of course, the name will be your name and the time depending on the current time that you run the function but all should be good if you reach this step.

If you do not get any result, check under Formula tab on the top ribbon and change the Calculation Options to Manual

So now our function is working, we just need to turn this to API. With AlchemyJ, we do not need to code or anything else.

First select Validate, this will auto check if everything is in order for the API to be generated. Once validation is completed, you should received a warning about the cell B1 is not empty.

Your error message should be like this

Cell referred by the Input Data Address is not empty. The cell value will not persist in the generated API.

We can ignore this warning error as AlchemyJ are able to automatically remove the cell value and will not persist in the generated API.

Next we select Generate API, proceed to save the workbook and let AlchemyJ do everything by it's own. Your API should be ready in less than a min.

If your API is not ready within a minute, look at the console. It might be downloading some updated repository before able to automatically code. This process is a one time process. The next time you generate API, this process will not run if not required.

AlchemyJ Compiler
AlchemyJ Compiler
Server Hosted Successfully

Once you see the above screen, your API is now hosted on your device and ready to be tested.

Launch any browser, and type in the below in your browser.

http://localhost:8080/endpointGroup/resource1?input_parameter_1=YOUR NAME

Your browser should show you a response as below.

Your API response in browser

That's it, your first REST API is completed.

Let me know what you think and look forward for my next post.


Recent Posts

See All


bottom of page