第二十四章 源代码文件 REST API 参考(六)
Compile
此方法编译源代码文件。它允许一次编译多个源代码文件。它返回一个对应源代码文件对象的数组。
要编译的文件列表作为 JSON
数组在 http
请求的正文中传递。例如,[ "%Api.DocDB.cls", ... ]
。
有关示例和其他详细信息,请参阅本手册教程章节中的编译文件。
URL
POST http://server:port/api/atelier/v1/namespace/action/compile
此调用需要标头 Content-Type application/json
。
URL Parameters
-
可以传递
URL
参数“flags”
(默认为“cuk”
),该参数将传递给编译器。 -
如果不希望返回已编译的源代码文件的源,则可以使用值
0
传递URL
参数'source'
。
JSON Messages
以下是编译 Atelier.NewClass1
时返回的内容:
{
"status": {
"errors": [],
"summary": ""
},
"console": [
"Compilation started on 01/12/2016 17:44:00 with qualifiers 'cuk'",
"Compiling class Atelier.NewClass1",
"Compiling table Atelier.NewClass1",
"Compiling routine Atelier.NewClass1.1",
"Compilation finished successfully in 0.067s.",
""
],
"result": {
"content": [
{
"name": "Atelier.NewClass1.cls",
"status": "",
"content": [
"Storage Default",
"{",
"<Data name=\"NewClass1DefaultData\">",
"<Value name=\"1\">",
"<Value>%%CLASSNAME</Value>",
"</Value>",
"</Data>",
"<DataLocation>^Atelier.NewClass1D</DataLocation>",
"<DefaultData>NewClass1DefaultData</DefaultData>",
"<IdLocation>^Atelier.NewClass1D</IdLocation>",
"<IndexLocation>^Atelier.NewClass1I</IndexLocation>",
"<StreamLocation>^Atelier.NewClass1S</StreamLocation>",
"<Type>%Storage.Persistent</Type>",
"}",
""
],
"db": "IRISSYS",
"ts": "2016-01-12 17:44:00.053",
"enc": false,
"flags": 1
}
]
}
}
与源代码文件有关的错误将出现在每个源代码文件对象的状态属性中。
如果编译持久类导致存储定义更改,则存储定义作为源代码文件对象的内容返回。否则结果内容将为空。
HTTP Return Codes
HTTP 200
如果正常。- 如果资源名称是无效的源代码文件名,则返回
HTTP 400
。 - 如果找不到资源,则返回
HTTP 404
。 - 如果源代码文件被锁定,
HTTP 423
。 HTTP 500
如果发生意外错误(详细信息将在状态错误数组中)。
Index
此方法返回指定源代码文件的摘要信息。应用程序可以使用此信息来创建源代码文件的索引。它返回一个索引源代码文件对象数组。
要索引的源代码文件列表在 http
请求的正文中传递。请求正文是源代码文件名称的 JSON 数组。例如,[ "%Api.DocDB.cls", ... ]
。
URL
POST http://server:port/api/atelier/v1/namespace/action/index
此调用需要标头 Content-Type application/json
。
JSON Messages
与源代码文件有关的错误位于每个源代码文件对象的状态属性中。返回的数组包含与服务器上源代码文件的结构和文档相关的信息。它会因源代码文件所属的类别而异。以下是一个类(类别 CLS
)的示例。 (目前我们只支持类的索引。):
{
"status": {
"errors": [],
"summary": ""
},
"console": [],
"result": {
"content": [
{
"name": "%Activate.GenericObject.cls",
"db": "IRISLIB",
"ts": "2016-01-04 14:00:04.000",
"gen": false,
"others": [
"%Activate.GenericObject.1.INT"
],
"cat": "CLS",
"content": {
"desc": "This class provides functionality to create an ActiveX object, invoke its methods and Get/Set its properties by name.",
"depl": false,
"depr": false,
"final": false,
"hidden": false,
"super": [
"%Activate.IDispatch"
],
"methods": [
{
"name": "CreateObject",
"desc": "This method is used to create a generic object given only its progid. If the object cannot be found an exception is thrown.
The return value should be tested against $$$NULLOREF in the usual manner to ensure that the object has been successfully created",
"depr": false,
"final": true,
"internal": false,
"private": false,
"scope": "class",
"returntype": "%Library.RegisteredObject",
"args": [
{
"name": "Progid",
"type": "%Library.String"
}
]
},
{
"name": "GetObject",
"desc": "This method is used to create a generic object from a moniker. If the object cannot be found an exception is thrown.
The return value should be tested against $$$NULLOREF in the usual manner to ensure that the object has been successfully created.",
"depr": false,
"final": true,
"internal": false,
"private": false,
"scope": "class",
"returntype": "%Library.RegisteredObject",
"args": [
{
"name": "Moniker",
"type": "%Library.String"
}
]
}
],
"parameters": [],
"properties": []
},
"status": ""
}
]
}
}
HTTP 返回码
HTTP 200
如果正常。- 如果传递的内容类型不是
application/json
,则HTTP 415
。 HTTP 500
如果发生意外错误(详细信息将在状态错误数组中)。