Skip to content

Raw Requests

Arun Prakash edited this page Sep 21, 2025 · 3 revisions

🚀 Raw Requests

Send raw requests to handle responses outside of traditional model classes. This enables integration with database solutions for caching or storing responses.

// Raw via interface operations
final raw1 = await client.posts.listRaw(ListPostRequest(perPage: 5));
final raw2 = await client.posts.retrieveRaw(RetrievePostRequest(id: 123));
final raw3 = await client.media.createRaw(CreateMediaRequest( /* ... */ ));

// Or, send a totally custom raw request
final raw = await client.raw(
  WordpressRequest(
    method: HttpMethod.get,
    url: RequestUrl.relative('posts'),
    queryParameters: {'per_page': 1},
  ),
);
print(raw.code);
print(raw.data);

WordpressRawResponse contains the untyped body (string/bytes/json), headers, timing, and status code. You can parse and store it in any persistence layer you prefer.

Clone this wiki locally