Skip to content

feat: Regular Time entry support with name resolution helpers#153

Closed
shaank0 wants to merge 3 commits intowyre-technology:mainfrom
shaank0:feat/regular-time-entries
Closed

feat: Regular Time entry support with name resolution helpers#153
shaank0 wants to merge 3 commits intowyre-technology:mainfrom
shaank0:feat/regular-time-entries

Conversation

@shaank0
Copy link
Contributor

@shaank0 shaank0 commented Mar 14, 2026

Summary

  • Fix broken gzip headerContent-Encoding: gzip was being set on requests without actually compressing the body, causing 500 errors on POST requests
  • Add createDirect() to TimeEntries — enables creating time entries via POST /TimeEntries without requiring a parent ticket/task/project URL
  • Add SDK convenience methods for Regular Time workflows:
    • TimeTrackingClient.createRegularTimeEntry() — creates non-ticket time entries, auto-sets timeEntryType=5 (Activity), handles itemId response format
    • CoreClient.searchResources() / resolveResourceByName() — search and resolve resources by full name (splits first/last for accurate matching)
    • FinancialClient.getInternalBillingCodes() / resolveInternalBillingCodeByName() — get and resolve BillingCodes with useType=3 (internal allocation codes for Regular Time categories)

Key Autotask API discoveries documented in code:

  • Regular Time entries require internalBillingCodeID (NOT billingCodeID)
  • Only BillingCodes with useType=3 are valid for internal allocation (Internal Meeting, Training, PTO, etc.)
  • timeEntryType=5 (Activity) is required for Regular Time
  • The API returns {itemId: N} for creates, not {id: N}
  • The error message references "InternallAllocationCodeID" (with typo) but the actual REST API field is internalBillingCodeID

Test plan

  • Verify createDirect() POSTs to /TimeEntries without parent scoping
  • Verify createRegularTimeEntry() sets timeEntryType=5 automatically
  • Verify resolveResourceByName("Will Spence") correctly splits and resolves
  • Verify resolveInternalBillingCodeByName("Internal Meeting") returns correct ID
  • Verify getInternalBillingCodes() only returns useType=3 codes
  • Verify gzip fix resolves 500 errors on POST requests

🤖 Generated with Claude Code

shaank0 and others added 3 commits March 14, 2026 02:15
The transformRequest function was setting Content-Encoding: gzip on
request headers but sending the body as plain JSON (not actually
gzip-compressed). This caused the Autotask API to return 500 errors
on POST requests, particularly for child entity creates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a new createDirect() method to the TimeEntries entity that POSTs
directly to /TimeEntries without requiring a parent ticket, task, or
project. This enables creating "Regular Time" entries for meetings,
admin work, training, and other non-ticket time tracking.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds SDK-level helpers for creating Regular Time entries:

- TimeTrackingClient.createRegularTimeEntry(): Creates a time entry
  not tied to a ticket/task/project, automatically setting
  timeEntryType=5 (Activity) and handling the itemId response format

- CoreClient.searchResources(): Search resources by name or email
- CoreClient.resolveResourceByName(): Resolve a full name like
  "Will Spence" to a resource ID, splitting first/last name for
  accurate matching

- FinancialClient.getInternalBillingCodes(): Get BillingCodes with
  useType=3, which are the valid categories for Regular Time entries
  (e.g., Internal Meeting, Training, PTO)
- FinancialClient.resolveInternalBillingCodeByName(): Resolve a
  category name to a billing code ID with fuzzy matching

Key Autotask API details:
- Regular Time entries require internalBillingCodeID (not billingCodeID)
- Only BillingCodes with useType=3 are valid for internal allocation
- timeEntryType=5 (Activity) is required for Regular Time
- The API returns {itemId: N} for creates, not {id: N}

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
asachs01 added a commit that referenced this pull request Mar 15, 2026
Adds convenience methods for creating non-ticket time entries:

- TimeEntries.createDirect() — POST /TimeEntries without parent scope
- TimeTrackingClient.createRegularTimeEntry() — creates Regular Time
  entries with timeEntryType=5 (Activity), requires internalBillingCodeID
- CoreClient.searchResources() / resolveResourceByName() — search and
  resolve resources by full name with first/last split logic
- FinancialClient.getInternalBillingCodes() / resolveInternalBillingCodeByName()
  — fetch and resolve BillingCodes with useType=3 (internal allocation codes)

Key Autotask API discoveries documented in code:
- Regular Time requires internalBillingCodeID (NOT billingCodeID)
- Only BillingCodes with useType=3 are valid for Regular Time categories
- API returns { itemId: N } for creates, not { id: N }
- timeEntryType=5 (Activity) is required for Regular Time

Rebased from shaank0/feat/regular-time-entries (PR #153) onto main,
keeping main's gzip compression implementation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@asachs01
Copy link
Collaborator

Closing in favor of PR #155 which rebases all the new Regular Time features cleanly onto main, keeping main's gzip implementation. Thanks for the great contributions @shaank0!

@asachs01 asachs01 closed this Mar 15, 2026
asachs01 added a commit that referenced this pull request Mar 15, 2026
Adds convenience methods for creating non-ticket (Regular) time entries: TimeEntries.createDirect(), TimeTrackingClient.createRegularTimeEntry(), CoreClient.searchResources()/resolveResourceByName(), FinancialClient.getInternalBillingCodes()/resolveInternalBillingCodeByName(). Rebased from shaank0 PR #153.
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.

2 participants