当前位置:网站首页>Chapter 22 Source Code File REST API Reference (4)
Chapter 22 Source Code File REST API Reference (4)
2022-08-10 11:09:00 【yaoxin521123】
文章目录
第二十二章 源代码文件 REST API 参考(四)
PutDoc
This method saves the provided source code file.如果文件不存在,This method will create it,如果文件存在,This method replaces the existing file with the specified file.To ensure the correct version of the file is overwritten,请指定 If-None-Match header as well as previous PutDoc 或 GetDoc 的 ETAG The timestamp value returned in the header.If you want to overwrite the file without checking the version,请指定 ?ignoreConflict=1 URL 参数.This method returns a corresponding source code file object.If you want to save binary files,please pass in JSON 消息的 enc 元素设置为 true,and include the file contents as base64 块数组.If the text on the server was changed during the save process(For example via source control hooks),then the updated text will be returned in the content array of the returned source code file.
Errors related to source code files will be in the status property of the returned source code file object.
版本 2 PutDoc Can accept file content in three formats:默认 UDL 格式、XML format and old %RO The format used by the export utility. PutDoc Automatically recognizes the format of the file content.
For examples and other details,See Creating a New File or Updating an Existing File in a Namespace in the Tutorials chapter of this manual.
URL and Input JSON Message
PUT http://server:port/api/atelier/v1/namespace/doc/doc-name
PUT http://server:port/api/atelier/v2/namespace/doc/doc-name
Below is the source code file xyz.mac 的 PutDoc 的输入 JSON 消息示例:
{
"enc": false,
"content": [
"ROUTINE xyz",
"xyz ;",
" w \"hello\""
]
}
注意:如果正在创建 CSP 文件),则 doc-name 的值包括 /(斜杠)字符.这就是定义 PutDoc 的 URLMap contains the name of this parameter (.*) 而不是 :docname 的原因.
URL Parameters
可以传递 URL 参数 ?ignoreConflict=1 以绕过 ETAG 检查.This forces the source code files to be written to the server,Even if the file has changed since your previous access.
HTTP Headers
If-None-Match- To ensure the correct version of the file is overwritten,请指定If-None-Matchheader as well as beforePutDoc或GetDoc的ETAGThe timestamp value returned in the header.
JSON Messages
Below is the source code file xyz.mac 的 PUT 的返回内容:
{
"status": {
"errors": [],
"summary": ""
},
"console": [],
"result": {
"name": "xyz.mac",
"db": "INVENTORYR",
"ts": "2016-09-14 14:10:16.540",
"upd": false,
"cat": "RTN",
"status": "",
"enc": false,
"flags": 0,
"content": []
}
}
when a class is saved,PutDoc Always return to the storage section,Because it may be normalized by the server.If the content is only the storage part,则 'flags' json 字段将为 1.如果 PutDoc Returns the entire class in content or the content is empty,则“标志”将为 0.
HTTP 返回码
HTTP 200(if updated).HTTP 201(如果已创建).- If the resource name is an invalid source code filename,则返回
HTTP 400. - 如果找不到资源,则返回
HTTP 404. - If a conflict between server and client versions is detected based on timestamps,则
HTTP 409.如果文件存在,PutDoc将返回此代码,除非If-None-MatchThe header specifies the current timestamp value of the file on the server.如果存在冲突,The return message contains the content of the source code file on the server. - 如果未将
text/plainPassed as content type,则HTTP 415. - If the source code file is locked and cannot be written,则
HTTP 425. HTTP 500如果发生意外错误(详细信息将在状态错误数组中).
GetDoc
This method returns the text naming the source code file and namespace.
The returned content will contain a source code file object.
Errors related to source code files will be in the status property of the source code file object.If source control hooks are enabled for the namespace,then any console output generated by the hook will be captured and used as “控制台”An array of rows in an array is returned.
The result contains the name of the requested file、A database for storing files、Timestamp and category abbreviation (CLS = class; RTN = routine; CSP = CSP file;OTH = other),and the source code file contents returned as an array.
- 对于文本文件,This will be an array of strings,并且
“enc”json字段将设置为false. - 对于二进制文件,这将是一个
base64An array of encoded blocks,并且“enc”字段将设置为true.
版本 2 GetDoc 可以以 UDL 格式(默认)、XML format or old %RO The format used by the export utility returns the file contents.
URL
GET http://server:port/api/atelier/v1/namespace/doc/doc-name
GET http://server:port/api/atelier/v2/namespace/doc/doc-name
注意:If getting CSP 文件,则 doc-name 的值包括 /(斜杠)字符.这就是定义 GetDoc 的 URLMap contains the name of this parameter (.*) 而不是 :docname 的原因.有关详细信息,请参阅创建 REST 服务中的“为 REST 创建 URL 映射”.
URL Parameters
- 可以传递
URL参数?binary=1to force source code files to be encoded as binary. - 可以传递
URL参数?storageOnly=1to return only the stored part of the class. - 在版本
2中,可以传递URL参数?format= parameterto specify should beUDL格式(默认)、XMLformat or old%ROThe format used by the export utility returns the contents of the file.?format=udl?format=xml?format=%RO
如果指定 ?binary=1,GetDoc The format parameter will be ignored.
HTTP Headers
If-None-Match- Specifies the last call to this fileGetDoc或PutDoc时在HTTP ETAGThe value returned in the header.If the file has not changed since the last call,GetDoc将返回HTTP 304状态.
JSON Messages
以下是请求 %Api.DocDB.cls Returns an example of the first part of the result:
{
"status": {
"errors": [],
"summary": ""
},
"console": [],
"result": {
"name": "%Api.DocDB.cls",
"db": "IRISLIB",
"ts": "2016-09-13 22:31:24.000",
"upd": true,
"cat": "CLS",
"status": "",
"enc": false,
"flags": 0,
"content": [
/// Routing class for the DocDB REST services",
"Class %Api.DocDB Extends %DocDB.REST",
"{",
...
以下是 ?binary=1 result of the same request:
{
"status": {
"errors": [],
"summary": ""
},
"console": [],
"result": {
"name": "%Api.DocDB.cls",
"db": "IRISLIB",
"ts": "2016-01-04 14:00:04.000",
"cat": "CLS",
"status": "",
"enc": true,
"content": [
"Ly8vIFRoaXMgY2xhc3MgaXMgdGhlIHN1cGVyY2xhc3MgZm9yIGFsbCBl ... PSAzIF0KewoKfQo="
]
}
}
HTTP 返回码
HTTP 200如果正常.- If the source code file has not been modified,则为
HTTP 304(请参阅https://en.wikipedia.org/wiki/HTTP_ETag). - If the named resource is not a valid source code filename,则返回
HTTP 400. - 如果The source code file does not exist,则返回
HTTP 404. - HTTP 500 如果发生意外错误(详细信息将在状态错误数组中).
如果发生“soft”错误,例如“The source code file does not exist”,can be found in the result“状态”Additional information can be found in the fields.Examples of other soft errors include“文件已锁定”.例如,可以使用 HTTP 404 The return code returns the following:
{
"status": {
"errors": [],
"summary": ""
},
"console": [],
"result": {
"name": "xyz1.mac",
"db": "",
"ts": "",
"cat": "RTN",
"enc": false,
"content": "",
"status": "ERROR #16005: Document 'xyz1.mac' does NOT exist"
}
}
边栏推荐
- AUTOCAD——减少样条曲线控制点数、CAD进阶练习(三)
- 关于json转换器缺失的问题,报错内容:No converter found for return value of type
- Store limited time seckill function system
- Dalian University of Technology & Pengcheng & UAE propose a mixed-scale triple network ZoomNet for camouflaged target detection, with SOTA performance!
- Research on motion capture system for indoor combined positioning technology
- [C language] Floating point number rounding
- 跨公网环境,路由策略,进行设备的访问
- js猜拳小游戏源码
- HCIP ---- VLAN
- The usage and difference between getParameter() and getAttribute()
猜你喜欢

1-IMU参数解析以及选择

Dry goods!ASSANet: Making PointNet++ faster and stronger

网络安全笔记5——数字签名

FastReport.Net 2022.2.17 Crack

Short video software development - how to break the platform homogenization

短视频软件开发——平台同质化如何破局

什么是抽象类

Redis6 (1) - Introduction to NoSQL Database and Installation of Redis

【勇敢饭饭,不怕刷题之链表】链表倒数节点问题

ISO9001在讲什么?过程方法和风险思维
随机推荐
POJ 1026 Cipher (置换群)
Pycharm终端出现PS问题、conda或activate不是内部命令问题..
ESP8266 Tutorial 1 - Introduction to ESP8266 Hardware Platform
ESP8266 Tutorial 2 - Burn AT Firmware
面试官:项目中 Dao、Service、Controller、Util、Model 怎么划分的?
FastReport.Net 2022.2.17 Crack
8月份DB-Engines 数据库排行榜最新战况
How can an organization judge the success of data governance?
3D rotating text animation js special effects
PTA 7-2 Summation and Counting of Diagonal Elements of Square Matrices Solution
Codeforces 814 C. An impassioned circulation of affection (dp)
Network Security Note 6 - Digital Certificates and Public Key Infrastructure
Unsafe的一些使用技巧
Introduction to cross-end development of Taro applet
让软件飞——“X+”技术揭秘
杭电多校-Loop-(不确定性贪心+线段树)
网络文化经营许可证
"MySQL Advanced Chapter" 6. Principles of index creation and design
Taro小程序跨端开发入门实战
js对象转FormData对象(一般用于上传)