开发者社区> 问答> 正文

钉钉api如何删除审批实例?

钉钉api如何删除审批实例?

展开
收起
防火防爆 2024-08-18 17:33:46 26 0
3 条回答
写回答
取消 提交回答
  • 要通过API删除宜搭审批实例,您可以参考以下步骤:1. 使用钉钉开放平台提供的服务端API:/v1/process/deleteInstance.json󠁪。2. 在调用该接口前,请确保您的应用拥有相应的接口调用权限,这通常需要在钉钉开发者后台进行配置。3. 准备必要的请求参数,包括但不限于: • appType󠁪: 您的应用类型。• systemToken󠁪: 系统级别的访问令牌。• userId󠁪: 操作者的用户ID。• language󠁪: 语言环境,默认为"zh_CN"。• processInstanceId󠁪: 需要删除的流程实例ID。下面是一个Java示例代码片段,展示如何调用此接口进行删除操作:public void instancesDelete() throws Exception {
    Config config = new Config();
    config.protocol = "https";
    config.regionId = "central";
    com.aliyun.dingtalkyida_1_0.Client client = new com.aliyun.dingtalkyida_1_0.Client(config);
    DeleteInstanceHeaders deleteInstanceHeaders = new DeleteInstanceHeaders();
    deleteInstanceHeaders.xAcsDingtalkAccessToken = "your_access_token_here";
    DeleteInstanceRequest deleteInstanceRequest = new DeleteInstanceRequest()
    .setAppType("your_app_type")
    .setSystemToken("your_system_token")
    .setUserId("operator_user_id")
    .setLanguage("zh_CN")
    .setProcessInstanceId("the_process_instance_id_to_delete");
    try {
    client.deleteInstanceWithOptions(deleteInstanceRequest, deleteInstanceHeaders, new RuntimeOptions());
    } catch (TeaException err) {
    // 错误处理逻辑...
    } catch (Exception _err) {
    TeaException err = new TeaException(_err.getMessage(), _err);
    // 错误处理逻辑...
    }
    }
    java请将上述代码中的your_access_token_here󠁪、your_app_type󠁪、your_system_token󠁪、operator_user_id󠁪以及the_process_instance_id_to_delete󠁪替换为实际的值。请注意,删除操作是不可逆的,请谨慎执行。此回答整理自钉钉群“钉钉开发者社区(互助群)”

    2024-08-28 12:27:54
    赞同 展开评论 打赏
  • 你应该说的是image.png
    这个功能
    java调用实列

    public void processInstancesTerminate() throws Exception {
            com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
            config.protocol = "https";
            config.regionId = "central";
            com.aliyun.dingtalkworkflow_1_0.Client client = new com.aliyun.dingtalkworkflow_1_0.Client(config);
            com.aliyun.dingtalkworkflow_1_0.models.TerminateProcessInstanceHeaders terminateProcessInstanceHeaders = new com.aliyun.dingtalkworkflow_1_0.models.TerminateProcessInstanceHeaders();
            terminateProcessInstanceHeaders.xAcsDingtalkAccessToken = "accessToken";
            com.aliyun.dingtalkworkflow_1_0.models.TerminateProcessInstanceRequest terminateProcessInstanceRequest = new com.aliyun.dingtalkworkflow_1_0.models.TerminateProcessInstanceRequest()
                    .setProcessInstanceId("zRfPT*********************159")
                    .setIsSystem(false)
                    .setRemark("审批单提交错误,需要撤销")
                    .setOperatingUserId("审批发起人userId");
            try {
                TerminateProcessInstanceResponse terminateProcessInstanceResponse = client.terminateProcessInstanceWithOptions(terminateProcessInstanceRequest, terminateProcessInstanceHeaders, new RuntimeOptions());
                System.out.println(JSON.toJSONString(terminateProcessInstanceResponse.getBody()));
            } catch (TeaException err) {
                if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                    // err 中含有 code 和 message 属性,可帮助开发定位问题
                    System.out.println(err.code);
                    System.out.println(err.message);
                }
            } catch (Exception _err) {
                TeaException err = new TeaException(_err.getMessage(), _err);
                if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                    // err 中含有 code 和 message 属性,可帮助开发定位问题
                    System.out.println(err.code);
                    System.out.println(err.message);
                }
            }
        }
    

    参考链接

    https://open.dingtalk.com/document/orgapp/new-version-of-initiate-and-cancel-approval-flow

    撤销在这个页面的最下面

    回答不易请采纳

    2024-08-18 20:28:52
    赞同 3 展开评论 打赏
  • 面对过去,不要迷离;面对未来,不必彷徨;活在今天,你只要把自己完全展示给别人看。

    没有提供删除是,但是可以使用 撤销审批实例这个
    https://open.dingtalk.com/document/orgapp/revoke-an-approval-instance
    image.png

    2024-08-18 18:05:33
    赞同 展开评论 打赏
来源圈子
更多
收录在圈子:
+ 订阅
问答排行榜
最热
最新

相关电子书

更多
Spring Boot2.0实战Redis分布式缓存 立即下载
CUDA MATH API 立即下载
API PLAYBOOK 立即下载