My custom app trigger module has an empty response

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:

php

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:

json

{
“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 !

Welcome to the Make community!

1. This forum might have or already changed your text

When pasting text into this forum, you should format the example text using the rich-text editor, otherwise the forum software might modify the displayed text, and you might get incorrect answers from others because of it.

Some things this forum software might do to mangle your text:

– remove extra spaces (which may be necessary)
– convert links to titles (when copied is incorrect)
– incorrect joined links
– convert single and double quotes to smart angled quotes ()
– emojis
– etc.

This interferes with you receiving correct answers, because it:

– makes JSON invalid (you can verify when copy-paste into https://jsonformatter.org)
– makes incorrect text examples when we need to build a pattern for text parsing

2. To prevent this in future, please format text in code blocks

A. Type code fence manually
Either add three backticks ``` before and after the text, like this:

```
content goes here
```

B. Highlight and click the format button
Or use the format code button in the editor:
Screenshot_2023-10-02_191027

3. You might need to re-copy the original text

Once the post has been submitted, it’s too late to format it since it’s already butchered, and you need to make a re-copy of the text, and format it before submitting the forum post.

Please let us know once you have corrected the issue. This will avoid others potentially providing wrong answers based on incorrect text in your question.

Thank you!

Join the Make Fans Discord server to chat with other makers!

1 Like

Hi, sorry about it.

I re-created a post with a formated correctly code.

thanks !

This topic was automatically closed after 31 days. New replies are no longer allowed.