NativeREST
Overview
Documentation
Download a sample here – https://www.notion.so/gajduk/Mendix-Native-REST-example-1b1582a36fbc4d4da76919bdb77d77d5
Description
Has two javascript actions:
- CallRestService
Calls a WEB endpoint at a specified URL and waits for a response.
Interprets the response as text/string. HTTP Method and headers can be set.
- ImportJson
Parses a JSON string to Mendix objects.
The JSON keys are mapped to attributes/references based on name, so they must match exactly.
The user has to have access to create the object and write the attributes which are part of the JSON.
Date time can be parsed as epoch number of milliseconds or from a string with a dateTimeFormat (see example).
If a key in the json can not be mapped to an attribute it will be skipped silently i.e. no errors will be thrown.
The javascript action always returns a list even if there is only a single element at the root level.
Typical usage scenario
Calling a REST api from the client-side. Can be used for example in native apps.
Features and limitations
JSON import automatically maps key to attributes based on name. Nested objects/arrays are mapped to associated entities by key. See example
Attribute and reference names must match the JSON keys exactly otherwise they will not be parsed.
Dependencies
- None