. . .

Data Modeling with the RESTful API

First, we create a Module called MyTodoList containing our classes:Bash

Bash
curl -v -X POST -d moduleName=MyTodoList -d customerName=admin0815 -u admin0815@example.com:123456 https://apiomat.yourcompany.com/yambas/rest/modules/

Now, let’s create a class called Todo:Bash

Bash
curl -v -X POST -d metaModelName=Todo -u admin0815@example.com:123456 https://apiomat.yourcompany.com/yambas/rest/modules/MyTodoList/metamodels

Save / remember the meta model ID that is in the URL of the location header of the response.

The Todo class now gets a description attribute of type string. For the request url use the meta model ID from before here:Bash

Bash
curl -v -X POST -d attributeType=String -d attributeName=description -u admin0815@example.com:123456 https://apiomat.yourcompany.com/yambas/rest/modules/MyTodoList/metamodels/<METAMODELID>/attributes

You may add more classes and attributes here (for a Todo class a done and untilDate atttribute would make sense).

If you are ready, deploy your app (in our case using the LIVE system):Bash

Bash
curl -v -X PUT -d "{\"moduleStatus\":{\"LIVE\":\"DEPLOYED\"}}" -u admin0815@example.com:123456 -H "Content-Type: application/json" https://apiomat.yourcompany.com/yambas/rest/modules/MyTodoList