Question

Not sure how to test call to REST hook, documentation unclear

  • 23 August 2021
  • 4 replies
  • 38 views

I’m trying to set up a REST Hook api request. I can trigger the hook, but nothing happens. Maybe something goes wrong in the payload. However, I can’t manage to debug this issue. 

 

The documentation points to Step 2: Test your API Request and show this screenshot:

Test API Request UI in documentation

However in my UI I don’t get this interface, instead I see this:

 

Hope someone can clarify how I can properly test a call to a Rest hook. Documentation is not very clear on that. 


4 replies

@steve_franken Creating rest hook apps via the Platform UI can be tricky.

After configuring the initial subscribe code and perform code, you’ll need to ‘create a zap’, which will give you a trigger URL that you can use as the target for your test subscription. I usually use postman to kick off the initial subscription, using the provided rest hook URL from the test zap as my target.

Once you post the subscription, the service you’re subscribing to will send data to your test zap, which will show up in the ‘monitoring’ section of Platform UI, conveniently located next to the ‘create a zap’ button.

I suspect they put this here because it’s difficult to configure these properly on the first go. Many services require some type of handshake or asynchronous communication upon initial subscription, which needs to be configured properly in the ‘subscribe code’ of your app.

If your ‘post’ to subscribe via postman or other was configured properly, it should show up in the monitor logs. From there you should be able to determine what went wrong and figure out how to correct the issue. Once it’s configured properly, a test post from your subscription service will generate a response in the app setup page and you’ll be good to go.

Good luck, hope you sort it out!

I could sort it out luckily (by default it wraps a return value in an array, but if you return an array already you get an error. 

//return [bundle.cleanedRequest];
return bundle.cleanedRequest;

I’d recommend to update the documentation so it reflects the current product. 

Userlevel 5
Badge +8

Hey @steve_franken,

Thanks so much for flagging this issue with our platform documentation. I’ve passed over your comments to the relevant teams so we can review and update the documentation as necessary.

I’m really glad to hear you were able to get it sorted in the meantime though! :)
 

Thanks @steve_franken - I was setting up a new pollyesterday and ran into this issue. Appreciate you sharing this fix!

Reply