RESTClient

Storage and Headers

GetStorage, SetStorage, and DeleteStorage operate on the specified WebsiteStorageType. Configure the storage operation with WithStorageKey, WithStoragePath, WithStorageDomain, WithStorageStoreName, WithData, and WithDeleteAcrossOrigins. WithHeader adds a custom HTTP header to the REST request itself (not the browser - use storage methods for browser-level cookie manipulation). WithHttpMethod sets the HTTP method (GET, POST, PUT, DELETE, etc.) when calling non-standard endpoints.

Examples

GPAL Fluent: High-level fluent C# API

//Storage operations target the browser's in-memory storage, not the REST request headers. WithHeader adds a header to the HTTP request sent to the OttoMagic REST API itself.

// Delete all cookies before navigating

GPAL.RestClient

.WithAPIBase("http://localhost:9222")

.DeleteStorage(WebsiteStorageType.cookie)

.Execute();


// Get a specific localStorage key

string theme = GPAL.RestClient

.WithAPIBase("http://localhost:9222")

.GetStorage(WebsiteStorageType.localStorage)

.WithStorageKey("theme")

.Execute();


// Add a custom header to the REST request

GPAL.RestClient

.WithAPIBase("http://localhost:9222")

.WithHeader("X-Api-Key", "my-secret-key")

.WithEndpoint("/api/data")

.Execute();

💬 Ask GPAL