Hi, and thanks for the detailed write-up.
You are right about the current behaviour. In the API Query Builder, the request body for a POST is built exclusively from the Key/Value repeater, and the Body Type dropdown only offers JSON (application/json) and Form Data (x-www-form-urlencoded). There is currently no “raw / plain text” body option, so a query like the IGDB / APICalypse syntax you posted…
fields name,total_rating,summary,storyline,first_release_date;
where id = 23248;
…can’t be expressed through key/value pairs, which is exactly why it ends up as that broken JSON object.
I have logged this as a feature request to add a raw text body option (a free text box plus a Content-Type you can set yourself, e.g. text/plain). Thanks for pushing for it.
In the meantime there is a working PHP workaround. The builder exposes a filter right before the request is sent, so you can replace the body and the Content-Type yourself:
add_filter('bricksforge/api_query_builder/request_args', function ($request_args, $item) {
// Only target the relevant API item (check $item->url or $item->id)
if (strpos($item->url ?? '', 'igdb.com') !== false) {
$request_args['body'] = "fields name,total_rating,summary,storyline,first_release_date; where id = 23248;";
$request_args['headers']['Content-Type'] = 'text/plain';
}
return $request_args;
}, 10, 2);
That sends the body exactly as typed, with full control over the Content-Type header. (You can also use bricksforge/api_query_builder/request_headers if you only need to adjust headers.)
Let me know if that unblocks you for now.
Best,
Daniele