Hi everyone,
I need your help in developing my custom app. I created a module that works exactly like a watch row. However, before going further, I have a big problem: my module always returns an empty response.
When I test it with Postman, my request has the correct data, but in Make, nothing.
My code is extremely simple:
register_rest_route(‘qrtracker/v1’, ‘/watch-new-rows’, array(
‘methods’ => ‘GET’,
‘callback’ => array($this, ‘watch_new_rows’)
));
public function watch_new_rows(WP_REST_Request $request) {
error_log(‘watch_new_rows called’);
$headers = $request->get_headers();
error_log('Headers: ’ . print_r($headers, true));
$response = array(
'A' => 'A',
'B' => 'B',
'C' => 'C',
'short_url' => 'http://short.ly',
'dateatime' => '2024-12-16 12:00:00'
);
error_log('Response: ' . print_r($response, true));
return new WP_REST_Response($response, 200);
}
For now, I am not even implementing API verification or anything. The authentication works fine because when I put a wrong API key, I get an error from Make.
When I put a correct one, I get a 200 code.
I have placed error_logs, and on the PHP side, everything is fine. When I execute my request from Make, my error_logs have the correct data inside. But nothing comes back on the Make side and there is no error either.
The module configuration is also very simple:
{
“url”: “/watch-new-rows”,
“method”: “GET”,
“headers”: {
“Authorization”: “Bearer {{connection.apiKey}}”
},
“response”: {
“output”: “{{body}}”,
“error”: {
“message”: “[{{statusCode}}] {{body.error}}”
}
}
}
Interface :
[
{
“name”: “A”,
“type”: “text”,
“label”: “Column A”
},
{
“name”: “B”,
“type”: “text”,
“label”: “Column B”
},
{
“name”: “C”,
“type”: “text”,
“label”: “Column C”
},
{
“name”: “short_url”,
“type”: “text”,
“label”: “Short URL”
},
{
“name”: “dateatime”,
“type”: “text”,
“label”: “Date and Time”
}
]
Thank you so much, i’m lost !