Core concepts¶
RequestBuilder façade¶
The RequestBuilder serves as a high-level interface for constructing and executing HTTP operations for a specific API path. At each path diversion (after the base URI) introduce a new RequestBuilder.
Example:
Absolute URI: https://{instance}.service-now.com/api/now/{version}/table
To generate the appropriate RequestBuilder types:
- Remove the shared base URI: Strip the common prefix
https://{instance}.service-now.com/apito isolate the relative pathnow/{version}/table. - Segment the relative path: Split the path by
/, omitting the version segment. This yields two distinctRequestBuildertypes: NowRequestBuilderTableRequestBuilder
The base URI is
https://{instance}.service-now.com/api
Note: The SDK targets a single API version; exclude the version segment of the address.
RequestBuilder structure¶
Each RequestBuilder provides methods aligned with supported HTTP operations. These methods accept standardized parameters or enable construction of the next path segment. Internally, they handle:
- Request construction: Dynamically builds the HTTP request, including headers, query parameters, and payload.
- Request transmission: Sends the request through an HTTP client, supporting features such as retries and logging.
- Response handling: Converts raw HTTP responses into structured SDK types or error classes.
Batch API compatibility¶
All RequestBuilder types support batch operations using a shared convention:
ToXXXRequestInformation(…) (RequestInformation, error) methods.
These methods generate lightweight RequestInformation objects that encapsulate:
- The HTTP method
- Target address
- Headers and query parameters
- Request body (if applicable)
This approach enables batch execution without immediate transmission, allowing deferred or grouped interactions.