Skip to content

fix(tickets): correct filter field names and value shapes for list()#16

Merged
asachs01 merged 1 commit into
mainfrom
fix/tickets-list-filter-fields
May 28, 2026
Merged

fix(tickets): correct filter field names and value shapes for list()#16
asachs01 merged 1 commit into
mainfrom
fix/tickets-list-filter-fields

Conversation

@asachs01
Copy link
Copy Markdown
Member

Summary

  • tickets.list() filter builder used wrong field names / value shapes — every filtered call 400d
  • status: enum string → numeric parent statusId via lookup table
  • organizationId: field name → clientId (matches ticket schema)
  • Documented that boardId default of 1 isn't guaranteed per tenant

Closes #15

Test plan

  • npm test — 85/85 pass (added 3 regression tests asserting outgoing request body shape)
  • npm run build — clean
  • Verify against live us2 tenant: tickets.list({ boardId: 2, status: 'OPEN' }) returns rows instead of 400
  • Verify IN_PROGRESS=4000 / RESOLVED=5000 / ON_HOLD=7000 against NinjaOne API ref or a tenant that uses those parent IDs

Notes

Status IDs 4000/5000/7000 are inferred from the 1000-stride pattern. If a tenant uses different IDs for those system statuses, the filter would silently match nothing. Worth verifying before depending on it in production.

NinjaOne's ticket filter API rejects the enum string for status and the
field name `organizationId`, returning 400 for any filtered list call.

- status: map TicketStatus enum to numeric parent statusId
  (NEW=1000, OPEN=2000, WAITING=3000, CLOSED=6000 confirmed via live
  tenant; IN_PROGRESS=4000, RESOLVED=5000, ON_HOLD=7000 inferred from
  the 1000-stride pattern)
- organizationId: send as field `clientId` to match the ticket schema
- types: clarify that boardId default of 1 isn't guaranteed across tenants

Adds regression tests that capture the outgoing request body and assert
field names + value shapes.

Closes #15
@asachs01 asachs01 merged commit 73f0b8a into main May 28, 2026
2 checks passed
@asachs01 asachs01 deleted the fix/tickets-list-filter-fields branch May 28, 2026 02:53
github-actions Bot pushed a commit that referenced this pull request May 28, 2026
## [1.1.2](v1.1.1...v1.1.2) (2026-05-28)

### Bug Fixes

* **tickets:** correct filter field names and value shapes for list() ([#16](#16)) ([73f0b8a](73f0b8a)), closes [#15](#15)
asachs01 added a commit to wyre-technology/ninjaone-mcp that referenced this pull request May 28, 2026
Picks up the tickets filter-builder fix from
wyre-technology/node-ninjaone#16 — status enum now maps to numeric
parent statusId, organizationId filter sends as `clientId`. Filtered
ticket list calls will stop returning 400 from NinjaOne.
asachs01 added a commit to wyre-technology/ninjaone-mcp that referenced this pull request May 28, 2026
* fix(tickets): forward cursor as lastCursorId so pagination works

The tickets_list handler read args.cursor into a local variable, logged
it, then dropped it on the floor — every call returned page 1 regardless
of the cursor passed in. Forward it to the SDK as lastCursorId (number),
matching the SDK's parameter shape.

Closes #31

* feat(tickets): add ninjaone_tickets_boards_list tool

Surfaces the SDK's listBoards() so callers can discover board_id values
without trial-and-error or scraping URLs from the NinjaOne web UI.

Refs #31 (related-gap section)

* chore(deps): bump @wyre-technology/node-ninjaone to ^1.1.2

Picks up the tickets filter-builder fix from
wyre-technology/node-ninjaone#16 — status enum now maps to numeric
parent statusId, organizationId filter sends as `clientId`. Filtered
ticket list calls will stop returning 400 from NinjaOne.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tickets.list filter builder sends wrong field names and value shape — every filtered query 400s

1 participant