跳转到主要内容
内容类型为 multipart/form-data 的 HTTP 请求。

属性

NameTypeDescription
Urlstring资源 URL。
Methodstring请求类型(例如 GET 或 POST)。
AuthTokenstring身份验证令牌(如果需要外部服务身份验证)。
AuthSchemestring身份验证方案。
ThrowExceptionOnFailedboolean指定当外部服务将错误代码作为 HTTP 响应状态返回时,是否应引发异常。如果设置为 False,则不会引发异常,HTTP 状态码会存储在 Status 属性中。默认设置为 True。
Timeoutnumber响应超时时间(分钟)。默认设置为 1 分钟。重要! 请求超时值不能大于脚本的运行时限制(600 秒)。
ResponseTextstring, read-only以文本格式返回的响应结果。
ResponseTypestring, read-only服务返回的请求响应类型,例如 “application/json”。
Statusnumber外部服务的 HTTP 响应状态码。如果 ThrowExceptionOnFailed 设置为 True,则错误代码会引发异常并中断事务。可以在技能监控中查看错误消息文本。

方法

NameDescription
AppendStringContent(string data, string contentName);向请求正文添加一个 multipart/form-data 类型的 string(默认情况下,内容类型设置为 application/json,并使用 UTF-8 编码)。contentName 参数指定在可提交表单中的字段名称。
AppendStringContent(string data, string contentName, ContentEncoding contentEncoding, string mediaType?);向请求正文添加一个 multipart/form-data 类型的 string,并允许指定编码。如果未指定内容类型,则默认设置为 “application/json”。
AppendFileContent(DocumentExportResult documentExportResult, string contentName, string mediaType?);向请求正文添加 multipart/form-data 二进制数据。内容类型会根据传入文件的扩展名自动设置。如有需要,可以通过可选参数 mediaType 预先设置内容类型。
AppendFileContent(BinaryFile binaryFile, string contentName, string mediaType?);向请求正文添加以下二进制数据:导入到事务中的源图像,或字段类型为 Picture 的字段中包含的图像。内容类型会根据导入文件的扩展名自动设置。如有需要,可以通过可选参数 mediaType 预先设置内容类型。
AppendSourceFileContent(string contentName, string mediaType?);将导入到事务中的源图像的二进制数据添加到请求正文。内容类型会根据导入文件的扩展名自动设置。如有需要,可以通过可选参数 mediaType 预先设置内容类型。重要! 此方法已弃用。它只能访问该事务的第一个文件。应改用 AppendFileContent() 方法。
SetHeader(string name, string value);为请求设置额外的 HTTP 头。应针对每个头名称分别调用一次此方法。
Send();发送 HTTP 请求。