No edit summary |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<message>Write the content here to display this box</message> | |||
'''REST Services''' are services executed by connecting to a URL that defines operation and parameters and returns an answer – not seldom as JSON objects. | '''REST Services''' are services executed by connecting to a URL that defines operation and parameters and returns an answer – not seldom as JSON objects. | ||
Line 5: | Line 5: | ||
=== '''Calling Existing REST Services''' === | === '''Calling Existing REST Services''' === | ||
MDriven supports a couple of EAL operators to manage REST services. All operators reside on the [[selfVM]] variable which is available only in the ViewModel context. | MDriven supports a couple of EAL operators to manage REST services. All operators reside on the [[Documentation:SelfVM|selfVM]] variable which is available only in the ViewModel context. | ||
''selfVM.RestGet(targeturl,user,pwd,optionalnestingwithheaders)'' | ''selfVM.RestGet(targeturl,user,pwd,optionalnestingwithheaders)'' | ||
Read: [[OCLOperators RestGet]] | '''Read:''' [[Documentation:OCLOperators RestGet|OCLOperators RestGet]] | ||
''selfVM.RestPost(targeturl,user,pwd,optionalnestingwithheadersAndUploadValues)'' | ''selfVM.RestPost(targeturl,user,pwd,optionalnestingwithheadersAndUploadValues)'' | ||
Read: [[OCLOperators RestPost]] | '''Read:''' [[Documentation:OCLOperators RestPost|OCLOperators RestPost]] | ||
''selfVM.RestDownload(targeturl,user,pwd,optionalnestingwithheaders)'' | ''selfVM.RestDownload(targeturl,user,pwd,optionalnestingwithheaders)'' | ||
Read: [[OCLOperators RestDownload]] | '''Read:''' [[Documentation:OCLOperators RestDownload|OCLOperators RestDownload]] | ||
'''Note!''' ''optionalnestingwithheaders'' is the '''name''' of the blue ViewModel class in the example below (as an OCL String). | '''Note!''' ''optionalnestingwithheaders'' is the '''name''' of the blue ViewModel class in the example below (as an OCL String). | ||
Line 19: | Line 19: | ||
The action '''GetExporttest''' retrieves data by converting another ViewModel to XML - it stores it in the variable <code>vText</code>. | The action '''GetExporttest''' retrieves data by converting another ViewModel to XML - it stores it in the variable <code>vText</code>. | ||
The next action invokes RestPost to send that data to a URL address; it also says it should look at the nesting named 'Xml'. In this nesting, we have the STRINGCONTENT (see also [[OCLOperators RestPost]]) which gets its content from the vText variable. We also add the header Authorization with a bearer token to get access from the receiving service. | The next action invokes RestPost to send that data to a URL address; it also says it should look at the nesting named 'Xml'. In this nesting, we have the STRINGCONTENT ('''see also''' [[Documentation:OCLOperators RestPost|OCLOperators RestPost]]) which gets its content from the vText variable. We also add the header Authorization with a bearer token to get access from the receiving service. | ||
'''See also''': [[Documentation:Exposing Ourselves as a REST Service|Exposing Ourselves as a REST Service]] | '''See also''': [[Documentation:Exposing Ourselves as a REST Service|Exposing Ourselves as a REST Service]] | ||
[[Category:Rest]] | [[Category:Rest]] | ||
[[Category:Advanced]] | [[Category:Advanced]] | ||
{{Edited|July|12| | {{Edited|July|12|2025}} |
Latest revision as of 05:52, 6 February 2025
REST Services are services executed by connecting to a URL that defines operation and parameters and returns an answer – not seldom as JSON objects.
You must set the tagged value RestAllowed on the ViewModels you want to allow Rest access to.
Calling Existing REST Services
MDriven supports a couple of EAL operators to manage REST services. All operators reside on the selfVM variable which is available only in the ViewModel context.
selfVM.RestGet(targeturl,user,pwd,optionalnestingwithheaders)
Read: OCLOperators RestGet
selfVM.RestPost(targeturl,user,pwd,optionalnestingwithheadersAndUploadValues)
Read: OCLOperators RestPost
selfVM.RestDownload(targeturl,user,pwd,optionalnestingwithheaders)
Read: OCLOperators RestDownload
Note! optionalnestingwithheaders is the name of the blue ViewModel class in the example below (as an OCL String).
Example
The action GetExporttest retrieves data by converting another ViewModel to XML - it stores it in the variable vText
.
The next action invokes RestPost to send that data to a URL address; it also says it should look at the nesting named 'Xml'. In this nesting, we have the STRINGCONTENT (see also OCLOperators RestPost) which gets its content from the vText variable. We also add the header Authorization with a bearer token to get access from the receiving service.
See also: Exposing Ourselves as a REST Service