주소, 로그인 순서, 수집할 항목을 JSON 규칙으로 등록하세요. Android 앱을 다시 설치하지 않고 다음 실행부터 새 규칙을 적용합니다.
1. 사이트에 맞는 규칙 등록
아래 URL과 선택자는 예시입니다. 실제 사이트에 맞게 고친 다음 등록합니다. 비밀번호는 규칙에 직접 쓰지 않고 {{input.password}}로 참조합니다.
{
"id": "site-items",
"title": "API 로그인 후 항목 조회",
"revision": 1,
"engine": "http",
"inputs": [
{ "name": "username" },
{ "name": "password", "secret": true }
],
"steps": [
{
"id": "login",
"action": "request",
"url": "https://example.com/api/login",
"method": "POST",
"json": { "username": "{{input.username}}", "password": "{{input.password}}" },
"extract": { "type": "json", "path": "access_token" },
"expectStatus": 200
},
{
"id": "items",
"action": "request",
"url": "https://example.com/api/items",
"headers": { "Authorization": "Bearer {{steps.login.extracted}}" },
"extract": { "type": "json", "path": "data.items" },
"expectStatus": 200
}
],
"outputs": { "items": "{{steps.items.extracted}}" }
}
{
"id": "site-page",
"title": "웹 폼 로그인 후 항목 추출",
"revision": 1,
"engine": "browser",
"inputs": [
{ "name": "username" },
{ "name": "password", "secret": true }
],
"steps": [
{ "id": "open", "action": "goto", "url": "https://example.com/login" },
{ "id": "user", "action": "fill", "selector": "input[name=username]", "value": "{{input.username}}" },
{ "id": "password", "action": "fill", "selector": "input[name=password]", "value": "{{input.password}}" },
{ "id": "submit", "action": "click", "selector": "button[type=submit]" },
{ "id": "ready", "action": "waitFor", "selector": ".item-title" },
{ "id": "titles", "action": "extract", "selector": ".item-title" },
{ "id": "links", "action": "extract", "selector": "a.item-link", "attribute": "href" }
],
"outputs": { "titles": "{{steps.titles.extracted}}", "links": "{{steps.links.extracted}}" }
}
curl --fail-with-body https://request-grid.fika-d.com/v1/workflows/site-items \
-X PUT -H "Authorization: Bearer $GRID_TOKEN" \
-H 'Content-Type: application/json' \
--data-binary @workflow-http.json