API Design Principles
The Thirdfort Client API follows industry-standard design patterns based on Google's API Improvement Proposals (AIPs). These guidelines ensure our API is consistent, predictable, and easy to integrate with.
Resource-Oriented Design
Our API follows a resource-oriented architecture where:
- Resources are the fundamental building blocks (Checks, Organizations, Teams, Findings)
- Resources are organised in a hierarchical structure reflecting ownership relationships
- Standard operations (Create, Get, List, Update, Delete) behave consistently across all resources
Resource Names
Every resource has a unique, hierarchical name:
organizations/{org_id}/teams/{team_id}/checks/{check_id}
Use - as a wildcard to query across multiple parent resources:
organizations/-/teams/-/checks
Standard Methods
Most resources support these standard CRUD operations:
| Method | HTTP Verb | Path Pattern | Description |
|---|---|---|---|
| Create | POST | /{parent}/resources | Creates a new resource |
| Get | GET | /{name=...} | Retrieves a single resource |
| List | GET | /{parent}/resources | Lists resources with pagination |
| Update | PATCH | /{name=...} | Updates specific fields |
| Delete | DELETE | /{name=...} | Removes a resource |
Custom Methods
When standard CRUD operations don't fit, we use custom methods with a :verb suffix:
| Pattern | Example | Purpose |
|---|---|---|
:cancel | POST /checks/{id}:cancel | Irreversible state transitions |
:undelete | POST /checks/{id}:undelete | Restore soft-deleted resources |
:review | POST /findings/{id}:review | Complex state changes with metadata |
:search | POST /activityLogs:search | Complex queries beyond List filtering |
Custom methods use POST and accept a request body.
Batch Operations
For efficiency when working with multiple resources, we provide batch methods:
| Pattern | Example | Purpose |
|---|---|---|
:batchGet | GET /checks:batchGet?names=... | Retrieve multiple resources by name |
:batchDelete | POST /checks:batchDelete | Delete multiple resources atomically |
:batchReview | POST /findings:batchReview | Apply operations to multiple resources |
Batch methods reduce network round-trips and can provide transactional guarantees.
Long-Running Operations
Some operations take significant time to complete (e.g., batch deletions). These return an Operation resource that you can poll:
# 1. Start the operation
POST /v1alpha2/organizations/{org}/teams/{team}/checks:batchDelete
→ Returns: { "name": "operations/abc123", "done": false, ... }
# 2. Poll for completion
GET /v1alpha2/operations/abc123
→ Returns: { "name": "operations/abc123", "done": true, "response": {...} }
Singleton Resources
Some resources exist as exactly one per parent (not a collection). These use a static name segment:
organizations/{org}/teams/{team}/checks/{check}/checkSummary
Singletons support Get but not Create, List, or Delete — they're automatically managed.
Filtering and Pagination
Filtering
List operations support the filter parameter with common expression syntax:
GET /v1alpha2/checks?filter=state="COMPLETE" AND create_time>"2024-01-01T00:00:00Z"
Pagination
Large result sets are paginated. Use page_size and page_token:
# First page
GET /v1alpha2/checks?page_size=25
→ Returns: { "checks": [...], "next_page_token": "abc..." }
# Next page
GET /v1alpha2/checks?page_size=25&page_token=abc...
Field Masks
Update operations use field masks to specify which fields to modify:
PATCH /v1alpha2/checks/{id}
{
"notification_recipient": { "email": "new@example.com" },
"update_mask": "notification_recipient"
}
Only specified fields are updated; others remain unchanged.
HTTP/JSON Mapping
While our API is defined using Protocol Buffers (gRPC), all endpoints are accessible via REST/JSON:
| gRPC Concept | REST Equivalent |
|---|---|
| Service methods | HTTP endpoints |
| Request messages | JSON request body |
| Response messages | JSON response body |
google.protobuf.Empty | Empty response (204 or ) |
Versioning
The API uses a versioned path prefix:
- Current version:
/v1alpha2 - Preview endpoints: Marked with
PREVIEWvisibility, subject to change
Preview endpoints are production-ready but may evolve before becoming stable.