First Steps with GeneXus M

Official Content

This is a step-by-step guide to create your first Business API with GeneXus M.

If you didn't already, GeneXus M Installation Steps now, and then follow these steps.

Step 1: Sign In

Set the URI of the GeneXus Services and a valid GeneXus Account. 
(By the time this is written, https://gxmprovisioning.genexus.com is the Server URI to set, and User ID and User Password are the ones corresponding to your GeneXus Account)

Step 2: Create Project

Create your first Knowledge Base

Step 3: Start Modeling

Create your first Knowledge Base and then start modeling by discovering your business entities and their rules. For example, let's create an API for Insert/Update/Delete Customers

Entity Customer
{
	CustomerId* 
	CustomerName! [ DataType = Character, Length = 40 ]
	CustomerImage [ DataType = Image ]
	CustomerBalance [ Length = 10, Decimals = 2 ]
	CustomerRegisterDate [DataType = Date]
#Rules
	Error("Please specify a name") if CustomerName.IsEmpty();
	Default(CustomerRegisterDate, today());
#End
}

Once you declare your entities probably you want to expose different views of the data to different clients of your API

So, GeneXusM  allow presenting these different views, queries of your entities by using Data Providers

For example, expose all the customers with a balance > 10000

DataProvider GetCustomers
{
Customers
                Order CustomerName
                Where CustomerBalance > 10000
  {
          Customer 
          {
              Id = CustomerId          
              Name = CustomerName        
           }
  }
}					

Step 4: Run prototypes of your Business API

Now you have created the Customer Entity and the GetCustomers Data Provider, you can Build All and then Run your prototype

enlightenedStarting with this conceptual model, what is GeneXus M going to generate?

GeneXus M uses a business expert generator to create a database layer (DL) plus a business logic layer (BL) automatically and exposes the BL as a Restful API. Additionally, it generates a full Open API description of the API so that you can start using and trying it from any REST API client or any OPEN API editor like the Swagger online.

When you run the prototype, you get two URLs

1) The one of the Developer Menu (eg.: http://apps6.genexus.com/Id6ab5fb54b46b05021bce35ea5c39c5f3/static/developermenu.html)

Use it to Create, Read, Update, Delete data on your entities.

2) and the one of the OPEN API specification of your REST API (eg.: http://apps6.genexus.com/Id6ab5fb54b46b05021bce35ea5c39c5f3/static/default.yaml

Copy its content to http://editor.swagger.io to test it.

Notes:

schemes:
  - https

Congratulations! You got this first Business API up & running in a few minutes!

Now, it's time to create yours, and share the experience!

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.