Data Modeling with the RESTful API
First, we create a Module called MyTodoList containing our classes:
Bash
curl -vX POST https:
//apiomat
.org
/yambas/rest/modules/
\
-d moduleName=MyTodoList -d customerName=admin0815 -u admin0815@example.com:123456
Now, let’s create a class called Todo:
Bash
curl -vX POST https:
//apiomat
.org
/yambas/rest/modules/MyTodoList/metamodels
\
-d metaModelName=Todo -u admin0815@example.com:123456
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
curl -vX POST https:
//apiomat
.org
/yambas/rest/modules/MyTodoList/metamodels/
<METAMODELID>
/attributes
\
-d attributeType=String -d attributeName=description -u admin0815@example.com:123456
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
curl -vX PUT https:
//apiomat
.org
/yambas/rest/modules/MyTodoList
\
-d
"{\"moduleStatus\":{\"LIVE\":\"DEPLOYED\"}}"
-u admin0815@example.com:123456 \
-H
"Content-Type: application/json"