다단계 API 테스트 작업 수정¶
POST /api/v1/dialing_task/{task_uuid}/multi_task_modify
개요¶
Body 요청 매개변수¶
| 매개변수명 | 유형 | 필수 | 설명 |
|---|---|---|---|
| regions | array | Y | 지역 목록 빈 값 허용: False |
| task | json | Y | 작업 구성 빈 값 허용: False $maxDictLength: 20000 |
| task.name | string | Y | 작업 이름, trim 후 비어 있지 않으며 최대 256자, trim 결과 저장 빈 값 허용: False |
| task.frequency | string | Y | 테스트 빈도 빈 값 허용: False 선택 가능한 값: ['1m', '5m', '15m', '30m', '1h', '6h', '12h', '24h'] |
| task.desc | string | 작업 설명 빈 값 허용: False 빈 문자열 허용: True 예시: 설명입니다 |
|
| task.steps | array | Y | 단계 목록 빈 값 허용: False |
| tags | array | 태그 이름 목록 빈 값 허용: False 예시: ['xx', 'yy'] |
매개변수 추가 설명¶
데이터 설명.
| 매개변수명 | 유형 | 필수 | 설명 |
|---|---|---|---|
| regions | array | Y | 작업 실행 영역 |
| task | json | Y | 작업 상세 |
| task.name | string | Y | 작업 이름 |
| task.frequency | string | Y | 작업 빈도 |
| task.desc | string | N | 작업 설명 |
| task.steps | string | Y | 다단계 API 테스트 단계 목록 |
| task.steps.allow_failure | boolean | N | 이 단계가 실패할 경우 다음 단계를 계속 실행할지 여부 (유형이 http인 경우 필수) |
| task.steps.extracted_vars | array | N | 로컬 변수 목록 (유형이 http인 경우 필수) |
| task.steps.task | json | N | 단계 작업 상세 (유형이 http인 경우 필수) |
| task.steps.type | string | Y | 단계 작업 유형, 선택 가능한 값: [http,wait] http-http 요청 단계, wait-대기 단계 |
| task.steps.value | integer | N | 대기 시간 (단위: 초, 유형이 wait인 경우 필수) |
| task.steps.stepId | string | N | 단계 ID, 새 단계 생성 시 해당 매개변수는 필수가 아님 |
| tags | array | N | 태그 목록 |
참고: 단계 작업 상세 task.steps.task 매개변수 내부의 세부 사항은 사용자 정의 테스트를 참조하세요.¶
extracted_vars 매개변수 설명.
| 매개변수명 | 유형 | 필수 | 설명 |
|---|---|---|---|
| field | string | Y | 변수 값 |
| name | string | Y | 변수 이름 |
| secure | boolean | Y | 변수 값 암호화 여부 |
단계 작업 상세 task 매개변수 설명
| 매개변수명 | 유형 | 필수 | 설명 |
|---|---|---|---|
| name | string | Y | 단계 이름 |
| url | string | Y | URL |
| method | string | Y | URL 요청 메서드 |
| advance_options | json | N | 고급 옵션 |
| success_when_logic | enum | N | 선택 가능한 값: [and, or], success_when 매개변수 내의 논리 관계, 기본값은 and |
| success_when | array | Y | 테스트 판단 조건 |
| post_mode | string | N | 가용성 판단 모드, 기본값-default, 스크립트 모드-script |
| post_script | string | N | 가용성 판단 스크립트 내용 |
요청 예시¶
curl 'https://openapi.guance.com/api/v1/dialing_task/dial_xxxx/multi_task_modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"regions":["reg_xxxx"],"task":{"desc":"desc1","name":"multi-test3","steps":[{"task":{"name":"test","method":"GET","url":"https://xxxx","advance_options":{"request_options":{"headers":{"x-ft-auth-token":"xxxx","x-workspace-uuid":"wksp_xxxx"},"auth":{"username":"","password":""}},"request_body":{"body_type":"","body":""},"secret":{"not_save":false}},"post_mode":"script","post_script":"body = load_json(response[\"body\"])\n\nvars[\"uuid\"] = body[\"content\"][\"uuid\"]"},"type":"http","allow_failure":true,"extracted_vars":[{"name":"UUID","field":"uuid","secure":false}]},{"type":"wait","value":180},{"task":{"name":"test","method":"GET","url":"https://xxxx","advance_options":{"request_options":{"headers":{"x-ft-auth-token":"xxxx","x-workspace-uuid":"wksp_xxxx"},"auth":{"username":"","password":""}},"request_body":{"body_type":"","body":""},"secret":{"not_save":false}},"success_when":[{"status_code":[{"is":"200"}],"header":{"aaa":[{"is":"bbb"}]}}],"success_when_logic":"and","post_mode":"default"},"type":"http","allow_failure":true,"extracted_vars":[]}],"frequency":"30m"},"tags":[]}' \
--compressed
응답¶
{
"code": 200,
"content": {
"createAt": 1743501586,
"creator": "wsak_xxxx",
"declaration": {},
"deleteAt": -1,
"id": null,
"isLocked": false,
"regions": [
"reg_xxxx"
],
"regionsInfo": [
"reg_xxxx"
],
"status": 0,
"tagInfo": [],
"task": {
"config_vars": [],
"desc": "desc1",
"df_label": "",
"external_id": "dial_xxxx",
"frequency": "30m",
"name": "multi-test3",
"owner_external_id": "wksp_xxxx",
"post_url": "http://xxxxx",
"status": "ok",
"steps": [
{
"allow_failure": true,
"extracted_vars": [
{
"field": "uuid",
"name": "UUID",
"secure": false
}
],
"stepId": "03db0636-e25f-4327-a70c-20e99b12e4bc",
"task": "{\"name\": \"test\", \"method\": \"GET\", \"url\": \"https://xxxx\", \"advance_options\": {\"request_options\": {\"headers\": {\"x-ft-auth-token\": \"xxxx\", \"x-workspace-uuid\": \"wksp_xxxxx\"}, \"auth\": {\"username\": \"\", \"password\": \"\"}}, \"request_body\": {\"body_type\": \"\", \"body\": \"\"}, \"secret\": {\"not_save\": false}}, \"post_mode\": \"script\", \"post_script\": \"body = load_json(response[\\\"body\\\"])\\n\\nvars[\\\"uuid\\\"] = body[\\\"content\\\"][\\\"uuid\\\"]\"}",
"type": "http"
},
{
"stepId": "6c97b32e-6e21-4e41-9d9b-c3deb4f0b3fe",
"type": "wait",
"value": 180
},
{
"allow_failure": true,
"extracted_vars": [],
"stepId": "88f9ab01-bd59-4ed7-afe0-62a875dc84e1",
"task": "{\"name\": \"test\", \"method\": \"GET\", \"url\": \"https://xxx\", \"advance_options\": {\"request_options\": {\"headers\": {\"x-ft-auth-token\": \"xxxx\", \"x-workspace-uuid\": \"wksp_xxxx\"}, \"auth\": {\"username\": \"\", \"password\": \"\"}}, \"request_body\": {\"body_type\": \"\", \"body\": \"\"}, \"secret\": {\"not_save\": false}}, \"success_when\": [{\"status_code\": [{\"is\": \"200\"}], \"header\": {\"aaa\": [{\"is\": \"bbb\"}]}}], \"success_when_logic\": \"and\", \"post_mode\": \"default\"}",
"type": "http"
}
],
"workspace_language": "zh"
},
"type": "multi",
"updateAt": -1,
"updator": "",
"uuid": "dial_xxxx",
"workspaceUUID": "wksp_xxxx"
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-2F7F4ABE-138C-453E-9295-EF58A1F70F4A"
}