-
Couldn't load subscription status.
- Fork 4
Compose JSON Message
VinceZK edited this page Apr 4, 2020
·
10 revisions
An entity instance can be represented in JSON. The JSON is not just a format, but also a message that can be communicated between Client with Server, or even end to end in integration scenarios.
In the instance detail page, you can check the JSON by clicking the button 'Display in JSON'. Then a dialog will popup to show the instance detail in JSON format.

If you copy the JSON above into a HTTP request, then you will get a new person created in DB. Just like bellow:
POST http://localhost:3001/api/entity
Accept: */*
Cache-Control: no-cache
Content-Type: application/json
{ "ENTITY_ID": "person",
"person": {"HEIGHT": "170", "GENDER": "male", "FINGER_PRINT": "CA67DE15727C72961EB4B6B59B76743E",
"HOBBY":"Reading, Movie, Coding", "TYPE": "employee"},
"r_employee": {"USER_ID": "DH001", "COMPANY_ID":"DarkHouse", "DEPARTMENT_ID": "Development", "TITLE":
"Developer", "GENDER":"Male"}
"r_address": [
{"COUNTRY": "China", "CITY":"Shanghai", "POSTCODE": "999999",
"ADDRESS_VALUE":"Room #999, Building #99, XXXX Road #999",
"TYPE": "Current Live", "PRIMARY":1},
{"COUNTRY": "China", "CITY":"Seasaw", "POSTCODE": "888888",
"ADDRESS_VALUE" : "West Valley Lake",
"TYPE": "Born Place", "PRIMARY":0}],
"relationships":[ ]
}If you want to change the TITLE of an employee(person) from "Developer" to "Architect", then:
PUT http://localhost:3001/api/entity
Accept: */*
Cache-Control: no-cache
Content-Type: application/json
{ "ENTITY_ID": "person",
"INSTANCE_GUID": "2FBE7490E10F11E8A90957FA46F2CECA",
"r_employee": {"action": "update", "USER_ID": "DH001", "TITLE": "Architect"},
}
Want to add a new address? just do it in this way:
PUT http://localhost:3001/api/entity
Accept: */*
Cache-Control: no-cache
Content-Type: application/json
{ "ENTITY_ID": "person",
"INSTANCE_GUID": "2FBE7490E10F11E8A90957FA46F2CECA",
"r_address": [
{"action": "add", "COUNTRY": "China", "CITY":"Shanghai", "POSTCODE": "777777",
"ADDRESS_VALUE":"Building #909, YYYY Road #101",
"TYPE": "Office", "PRIMARY":0}
]
}