Parallel Requests
Execute multiple GET, POST, or PUT requests in parallel using a thread pool. Use for bulk operations: fetching many resources, batch inserts, or batch updates.
Methods
| Method | Use case |
|---|---|
parallel_get(endpoints, ...) | Fetch multiple endpoints (different URLs) in parallel |
parallel_post(endpoint, payloads, ...) | Same endpoint, multiple POST bodies |
parallel_put(endpoint, payloads, ...) | Same endpoint, multiple PUT bodies |
parallel_delete(endpoint, payloads, ...) | Same endpoint, multiple DELETE bodies (e.g. batch delete) |
All methods accept max_workers (default 8) and error_handling (ErrorHandling.FAIL_FAST, COLLECT, or LOG_ONLY). See ErrorHandling in the models reference.
Async equivalents aparallel_get, aparallel_post, aparallel_put, and aparallel_delete are async iterators that yield (index, result, error) tuples in order. See API Reference: Async parallel methods and Async operations.
parallel_get
Fetch multiple resources in parallel:
from intapp_rest_client import RestClient, ErrorHandling
with RestClient(base_url="https://api.example.com", api_key="key") as client:
endpoints = [
"/api/v4/objects/1",
"/api/v4/objects/2",
"/api/v4/objects/3",
]
# Default: raise on first error, return list of results
results = client.parallel_get(endpoints, max_workers=5)
# Collect errors and get partial results
results, errors = client.parallel_get(
endpoints,
error_handling=ErrorHandling.COLLECT
)
if errors:
print(f"{len(errors)} requests failed")parallel_post
Same endpoint, multiple POST bodies (e.g. batch insert):
from intapp_rest_client import RestClient, ErrorHandling
with RestClient(base_url="https://api.example.com", api_key="key") as client:
payloads = [
{"name": "Item 1", "value": 100},
{"name": "Item 2", "value": 200},
{"name": "Item 3", "value": 300},
]
results = client.parallel_post("/api/v4/items", payloads, max_workers=5)
# With error collection
results, errors = client.parallel_post(
"/api/v4/items",
payloads,
error_handling=ErrorHandling.COLLECT
)parallel_put
Same endpoint, multiple PUT bodies (e.g. batch update):
from intapp_rest_client import RestClient
with RestClient(base_url="https://api.example.com", api_key="key") as client:
payloads = [
{"id": 1, "status": "active"},
{"id": 2, "status": "inactive"},
]
results = client.parallel_put("/api/v4/items", payloads)parallel_delete
Same endpoint, multiple DELETE bodies (e.g. batch delete by id):
from intapp_rest_client import RestClient
with RestClient(base_url="https://api.example.com", api_key="key") as client:
payloads = [{"id": 1}, {"id": 2}, {"id": 3}]
results = client.parallel_delete("/api/v4/items", payloads, max_workers=5)Error Handling
| Value | Behavior | Return |
|---|---|---|
| FAIL_FAST (default) | Raise on first error | List of results (until failure) |
| COLLECT | Continue on error, collect failures | (results, errors) |
| LOG_ONLY | Same as COLLECT; also log each error | (results, errors) |
Each entry in errors is a dict with endpoint or payload_index, error, error_type, and optionally response_body.