No edit summary Tag: 2017 source edit |
No edit summary |
||
Line 21: | Line 21: | ||
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 [[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: | '''See also''': [[Documentation:Exposing Ourselves as a REST Service|Exposing Ourselves as a REST Service]] | ||
[[Category:Rest]] | [[Category:Rest]] | ||
[[Category:Advanced]] | [[Category:Advanced]] |
Revision as of 05:20, 17 June 2024
It has 2 distinct sections: Calling stuff with Rest and Serving stuff with Rest. It should probably be divided into 2 articles and links updated
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