automation-hub
latest
false
服务立即出站集成视频教程
重要 :
请注意此内容已使用机器翻译进行了部分本地化。
适用于公共部门的 Automation Hub API 指南
服务立即出站集成视频教程
简短说明:本视频介绍如何使用开放式 API 并通过 Service Now 票证触发概念创建,从而实现 Service Now 和 Automation Hub 之间的基本集成。
主要主题包括:
-
00:00 - 简介;
-
01:30 - 在事件表中为 Automation Hub 调查问卷设置自定义字段;
-
05:40 - 设置对 Automation Hub 执行 API 调用的业务规则;
-
10:50 - 新建事件并测试规则;
-
13:10 - 直接在 Automation Hub 中查看输出。
Service Now 配置中使用的代码
var params = {
"process_name": current.getDisplayValue()+" - "+current.short_description.toString(),
"process_description": current.short_description.toString(),
"category_id": parseInt(current.u_ah_business_area),
"rules": parseInt(current.u_ah_how_rule_based_is_your_task),
"input_type": parseInt(current.u_ah_how_would_you_describe_the_input_data_for_your_task_process),
"input_quality": parseInt(current.u_ah_how_would_you_describe_the_structure_of_your_input_data),
"stability": parseInt(current.u_ah_changes_in_the_next_6_months),
"documentation": parseInt(current.u_ah_documentation_type),
"owner": current.u_ah_process_owner.toString()
};
var json = new JSON();
var text = json.encode(params);
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://rpanavigator-pentest-open-api.azurewebsites.net/api/v1/openapi/automationidea');
request.setHttpMethod('POST');
request.setRequestHeader("Accept","application/json");
request.setRequestHeader("Content-Type","application/json");
request.setRequestHeader("x-ah-openapi-app-key","userapi");
request.setRequestHeader("x-ah-openapi-auth","openapi-token");
request.setRequestHeader("Authorization","Bearer 4ec2bd1f-af111111111111111/411497b2-cfa3-454d-1111111111111");
request.setRequestBody(text);
var requestBody = request.getRequestBody();
var response = request.execute();
var responseBody = response.getBody();
var responseObj = JSON.parse(responseBody);
var tenantURL = 'https://preprod-automation-hub.uipath.com/integrations_change/';
current.description = current.description+" /Info from Automation Hub:/"+responseObj.statusCode+" "+responseObj.message+"//Process url: "+tenantURL+responseObj.data.process_slug+"//Process name:"+responseObj.data.process_name;
current.update();
gs.log(response.getBody());
var params = {
"process_name": current.getDisplayValue()+" - "+current.short_description.toString(),
"process_description": current.short_description.toString(),
"category_id": parseInt(current.u_ah_business_area),
"rules": parseInt(current.u_ah_how_rule_based_is_your_task),
"input_type": parseInt(current.u_ah_how_would_you_describe_the_input_data_for_your_task_process),
"input_quality": parseInt(current.u_ah_how_would_you_describe_the_structure_of_your_input_data),
"stability": parseInt(current.u_ah_changes_in_the_next_6_months),
"documentation": parseInt(current.u_ah_documentation_type),
"owner": current.u_ah_process_owner.toString()
};
var json = new JSON();
var text = json.encode(params);
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://rpanavigator-pentest-open-api.azurewebsites.net/api/v1/openapi/automationidea');
request.setHttpMethod('POST');
request.setRequestHeader("Accept","application/json");
request.setRequestHeader("Content-Type","application/json");
request.setRequestHeader("x-ah-openapi-app-key","userapi");
request.setRequestHeader("x-ah-openapi-auth","openapi-token");
request.setRequestHeader("Authorization","Bearer 4ec2bd1f-af111111111111111/411497b2-cfa3-454d-1111111111111");
request.setRequestBody(text);
var requestBody = request.getRequestBody();
var response = request.execute();
var responseBody = response.getBody();
var responseObj = JSON.parse(responseBody);
var tenantURL = 'https://preprod-automation-hub.uipath.com/integrations_change/';
current.description = current.description+" /Info from Automation Hub:/"+responseObj.statusCode+" "+responseObj.message+"//Process url: "+tenantURL+responseObj.data.process_slug+"//Process name:"+responseObj.data.process_name;
current.update();
gs.log(response.getBody());