SUBTASK #49: Scan and device API endpoints
Maintainers usually reply within 1 day
@PavlockBlaine03 is already working on this.
Since Oct 27, 2026.
Assessment
This issue has not been assessed yet.
Description
What to do
The three endpoints the screens need: start a scan, get the scan status, and list devices. Each route checks access (the placeholder from #50), calls one service, and returns JSON in the shapes below. The shapes in this ticket are the contract: the scan screen and device list (subtasks 3 and 4) are built against them, so changing them later means changing those screens too.
Background
- Spec: WF-01, FR-13, OUT-01 (device inventory), OUT-03 (flag), OUT-06 (scan status and errors), CM-09, CM-11, CM-15
- System design: 2.0 routes requests; 2.2 Scan Manager (start), 2.2.1.3 Report Scan Status, 3.1.2 Find Devices; section 14.1 (paginated results)
- Rules are in #49.
The endpoints and their JSON
POST /api/scans: start a scan
Request: {"scope": "192.168.1.0/24"}
| Result | Status | Body |
|---|---|---|
| Started | 202 Accepted | {"scan_id": 12, "status_url": "/api/scans/status"} |
| Another scan is running | 409 Conflict | {"error": "A scan started by sam at 14:03 is still running."} |
| Bad or missing scope | 400 Bad Request | {"error": "10.0.0.0/8 is larger than the limit of 1024 addresses"} |
The scan is started as the user making the request (the #50 placeholder until M4), so it records who started it (CM-11).
GET /api/scans/status: what the scanner is doing
While a scan runs:
{"running": true, "scan_id": 12, "scope": "192.168.1.0/24",
"started_by": "sam", "started_at": "2026-10-26T14:03:00", "elapsed_seconds": 6,
"phase": "discovering_hosts", "done": 120, "total": 254,
"errors": ["ping unavailable: ping command not found"]}
When nothing is running:
{"running": false, "last_scan": {"scan_id": 12, "scope": "192.168.1.0/24",
"started_by": "sam", "started_at": "2026-10-26T14:03:00", "ended_at": "2026-10-26T14:03:11",
"outcome": "partial", "errors": ["ping unavailable: ping command not found"]}}
Before any scan: {"running": false, "last_scan": null}
GET /api/devices?page=1&per_page=50: the device list
{"devices": [
{"device_id": 7, "name": null, "type": "unknown", "vendor": "Apple, Inc.",
"ip": "192.168.1.23", "mac": "F0:D1:A9:12:34:56", "is_randomized_mac": false,
"network_status": "online", "confidence": 20, "flagged": true, "trusted": false,
"last_seen": "2026-10-26T14:03:09"}],
"page": 1, "per_page": 50, "total": 14}
- Vendor and type are names, not ids. Name is
nullwhen unknown; the screen shows "Unknown". - Sorted by
last_seen, newest first.per_pagedefaults to 50, maximum 200. - Bad
page/per_page(not a number, 0, over 200): 400 with a reason.
Steps
-
backend/controller/api_routes.py, registered through #50'sregister_routes - Each route: the access check (#50), one service call, the JSON above. No database code in the routes (tier rules).
- The device list needs vendor and type names in one query, not one lookup per device. If 3.1.2 Find Devices (#15) only returns ids, add a list query to 3.1 that joins the
vendoranddevice_typenames and supportsLIMIT/OFFSETplus a total count. - Don't use
find_reference_rules()for the names: it leaves out retired vendors and types, but devices still show them (DI-06). - Write the three JSON examples above into the README's API section, so the screen builders have them.
- Tests with Flask's test client and fake services (no database or network):
- Start: 202 with the scan id; 409 with the refusal text; 400 for a bad scope and for a missing body
- Start passes the calling user's id to the Scan Manager
- Status: the running shape, the finished shape, and the "no scans yet" shape
- Devices: names instead of ids, newest first, paging (
totalcorrect, second page right), empty list, bad paging values
Where
backend/controller/api_routes.py, possibly a list query in backend/data_access/network_data/, tests/controller/test_api_routes.py
Done when
- With the app running,
POST /api/scansstarts a real scan,GET /api/scans/statusfollows it to the end, andGET /api/devicesthen lists the devices found - All route tests pass without a database
Depends on
- #50 Application entry point and controller
- #48 Scan Manager (
start) and #47 Report Scan Status - #15 Network Data (3.1.2 Find Devices)
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- Avg merge
- 9h 31m
- Merged PRs (30d)
- 36
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Bearkat-Professionals/Software-Engineering-Project
-
SUBTASK #86: Password hashing (BB-5)Possibly taken @Edgeless6 claimed this 3 days ago. Openbackend Low Priority subtask
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Bearkat-Professionals/Software-Engineering-Project#87 · 1 assignee ·
Maintainers usually reply within 1 day
-
Enhancement: Regression tests for Validate Input crash fixes (SH-1)Possibly taken @yoshi301 claimed this 2 days ago. Openbackend Low Priority
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Bearkat-Professionals/Software-Engineering-Project#59 · 1 assignee ·
Maintainers usually reply within 1 day
-
SUBTASK #86: Manage user accounts (admin)Possibly taken @Edgeless6 claimed this 3 days ago. Openbackend Low Priority subtask
Difficulty 4/5 Over a week Newbie friendliness 20/100
Bearkat-Professionals/Software-Engineering-Project#92 · 1 assignee ·
Maintainers usually reply within 1 day
-
SUBTASK #86: Login screen and signed-in layoutPossibly taken @Solo-Her0 claimed this 3 days ago. Openfrontend Low Priority subtask
Difficulty 4/5 3-5 days Newbie friendliness 28/100
Bearkat-Professionals/Software-Engineering-Project#91 · 1 assignee ·
Maintainers usually reply within 1 day
-
SUBTASK #86: Sessions and route protection in the Application Controller (2.0)Possibly taken @javi120467 claimed this 3 days ago. Openbackend Low Priority security subtask
Difficulty 4/5 3-5 days Newbie friendliness 22/100
Bearkat-Professionals/Software-Engineering-Project#90 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in Bearkat-Professionals/Software-Engineering-Project
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
cline/mcp-marketplace#3576 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
griptape-ai/griptape-nodes-library-elevenlabs#30 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
awslabs/social-messaging-agent-runtime-toolkit#140 ·
Maintainers usually reply within 1 day
-
subtask
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
fga-eps-mds/2026.2-MeasureSoftGram-DOC#187 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
NSPG13/agent-bounties#1747 ·
Maintainers usually reply within 1 day