다단계 API 테스트 생성¶
POST /api/v1/dialing_task/multi_task_add
개요¶
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'] |
파라미터 추가 설명¶
데이터 설명.
| 파라미터명 | type | 필수 | 설명 |
|---|---|---|---|
| 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 | 이 단계 실패 시 다음 단계를 계속 실행할지 여부 (type이 http인 경우 필수) |
| task.steps.extracted_vars | array | N | 지역 변수 목록 (type이 http인 경우 필수) |
| task.steps.task | json | N | 단계 작업 상세 (type이 http인 경우 필수) |
| task.steps.type | string | Y | 단계 작업 유형,可选值:[http,wait] http-http 요청 단계, wait-대기 단계 |
| task.steps.value | integer | N | 대기 시간 (단위:초, type이 wait인 경우 필수) |
| tags | array | N | 태그 목록 |
참고: 단계 작업 상세 task.steps.task 파라미터 내부의 구체적인 세부 사항은 自定义拨测 참조¶
extracted_vars 파라미터 설명.
| 파라미터명 | type | 필수 | 설명 |
|---|---|---|---|
| field | string | Y | 변수 값 |
| name | string | Y | 변수 이름 |
| secure | boolean | Y | 변수 값 암호화 여부 |
단계 작업 상세 task 파라미터 설명
| 파라미터명 | type | 필수 | 설명 |
|---|---|---|---|
| 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/multi_task_add' \
-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"
}