Getting the full URL called of an API endpoint
I'm using Hubspot and I need to implement a verification of the authenticity of a call from Hubspot to a Xano API endpoint.
For this verification, I need the exact same URL called by Hubspot, as is (with query parameters if there's any) to include it in the string that will be hashed and compared.
However, I noticed that $request_uri only returns the portion of the call that succeeds the domain name, so it starts at /api:myapicode/myendpoint. I'm not even sure it includes the query parameter. I did not test.
Is there a sure way, including in Lambda perhaps, to fetch the full URL with variables including the URL query parameters if any is present? Like so :
"https://myxanodomain.com/api:myapi/myendpoint?param1=value1¶m2=value2"
Thank you !
Matt
Comments
-
There is another env variable called $request_querystring that can serve you in this use case. Jam (or "concat") it together with the request URI to get your reconstructed called URL. https://docs.xano.com/what-xano-includes/workspace/settings/environment-variables
-
@Ray Deck You don't need $request_querystring with $request_uri. I just tested and $request_uri has all except the domain.
So I guess there is no other way than write the domain in plain text and concat the $request_uri, huh… -
THat's what I get for posting before I test. Yes, you are quite correct - I was tackling the wrong end of this. You can get the host (separate from the path/querystring) from $http_headers.Host. And the scheme (https) from X-Scheme.
Here's a screenshot of putting the full thing back together: -
VERY interesting solution :) I'm pretty sure this will do. Thank you @Ray Deck 🙌
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback