当前位置:网站首页>Chapter 4 use%rest API classes create rest services
Chapter 4 use%rest API classes create rest services
2022-07-23 15:07:00 【yaoxin521123】
List of articles
Chapter four Use %REST.API Class creation REST service
This chapter describes how to use %REST.API Class to create 、 Update and delete REST service .
Use %REST.API Class creation or update REST service
establish REST The service recommendation method is from REST Service OpenAPI 2.0 Specification starts , And use it to generate REST Service . To use %REST.API Class to perform this operation :
- obtain
RESTServiceOpenAPI 2.0standard , useJSONFormat , And save the specification as a file . The file must beUTF-8Coded . - Before you want to define
RESTIn the namespace of the service , Use this file to create%DynamicObjectExample . - And then call
%REST.APIClassCreateApplication()Method . This method has the following signature :
classmethod CreateApplication(applicationName As %String,
swagger As %DynamicObject = "",
ByRef features,
Output newApplication As %Boolean,
Output internalError As %Boolean)
as %Status
applicationNameIs the name of the package in which the class is to be generated .swaggerRepresentOpenAPI 2.0canonical%DynamicObjectExample .
You can also specify this parameter as canonical URL、 The pathname or empty string of the file containing the specification .
features- Must be passed by referencefeaturesIt's a multidimensional array , It contains any additional options :- If
features("addPing")yes1And if theswaggerIt's an empty string , Then the generated class will contain a for testing purposesping()Method . - If
features("strict")iyes1( The default value is ), that All properties in the specification will be checked . Iffeatures("strict")iby 0, Then only check the attributes required for code generation .
- If
newApplicationReturn as output , It's a Boolean value , Indicates that the method is to create a new application(true)Or update existing applications .internalErrorReturn as output , It's a Boolean value , Indicates whether an internal error has occurred .
If this method generates a new application ,IRIS Will be created in the given package disp、impl and spec class .
If this method updates an existing application ,IRIS Will regenerate disp and spec Class and update impl class , Keep the edits made to this class .
If OpenAPI 2.0 Invalid specification , Then the method will not make any changes .
- Create an access
RESTServiceWebApplications , As in the front of this book “ establishWebApplications ” Described in . - according to “ Modify the implementation class ” The description in the chapter defines the implementation .
An example of the first step is shown below :
set file="c:/2downloads/petstore.json"
set obj = ##class(%DynamicAbstractObject).%FromJSON(file)
do ##class(%REST.API).CreateApplication("petstore",.obj,,.new,.error)
//examine error and decide how to proceed...
...
Use %REST.API Class deletion REST service
To use %REST.API Class deletion REST service :
- You can find
RESTIn the namespace of the service , call%REST.APIClassDeleteApplication()Method . This method has the following signature :
classmethod DeleteApplication(applicationName As %String) as %Status
among applicationName Is included REST The name of the package of the service class .
2. ( Optional ) Manually delete the implementation class .
To be on the safe side , Class methods do not automatically delete implementation classes , Because this class may contain a lot of customization .
- Delete this before
RESTCreated by serviceWebApplications ( If there is ). So :
a. In the management portal , single click System Administration > Security > Applications > Web Applications.
b. On the list Web Click delete... In the row of the application .
c. Click OK to confirm the deletion .
边栏推荐
- Reflection invokes transaction methods, resulting in transaction invalidation
- Kettle實現共享數據庫連接及插入更新組件實例
- General of MySQL_ Log log
- IO流之 字节流 & 字符流
- Subsequence --- edit distance
- supervisord安装使用
- 报错 | cannot read property ‘_normalized‘ of undefined
- 基于matlab的BOC调制信号捕获仿真
- Transferred from Yuxi information disclosure: products such as mRNA covid-19 vaccine and Jiuzhou horse tetanus immunoglobulin are expected to be on the market within this year.
- 基于matlab的CBOC信号调制解调仿真,输出其相关性,功率谱以及频偏跟踪
猜你喜欢

Transferred from Yuxi information disclosure: products such as mRNA covid-19 vaccine and Jiuzhou horse tetanus immunoglobulin are expected to be on the market within this year.

基于双目相机拍摄图像的深度信息提取和目标测距matlab仿真

直播课堂系统03-model类及实体

Liunx:浅析vim编辑器基本使用

直播课堂系统02-搭建项目环境

什么是服务器托管及和虚拟主机的区别

Leetcode: 17. letter combination of phone number

Getting started with Prometheus (III)

IO流之 字节流 & 字符流

Opencv calculation outsourcing rectangle
随机推荐
Transferred from Yuxi information disclosure: products such as mRNA covid-19 vaccine and Jiuzhou horse tetanus immunoglobulin are expected to be on the market within this year.
mysql 之general_log日志
[software test] redis abnormal test encountered in disk-to-disk work
Openharmony South learning notes - hi3861+hc-sr04 ultrasonic testing
Map structure stored in the room of jetpack series
Simulation of voltage source PWM rectifier with double closed loop vector control based on Simulink
俄方希望有效落实农产品外运“一揽子”协议
Russia hopes to effectively implement the "package" agreement on the export of agricultural products
什么是Promise?Promise有什么好处
Oracle 报表常用sql
Building personal network disk based on nextcloud
day18
Use of KOA framework
[untitled] test [untitled] test
Blazor quickly realizes Minesweeper
安全合理用电 收获清凉一“夏”
String function of MySQL function summary
Simulation of synchronization performance of BOC modulation and demodulation based on MATLAB, output tracking curve and identification curve under different lead lag code distance
IO流之 字节流 & 字符流
Postgresql快照优化Globalvis新体系分析(性能大幅增强)