We have a Sitecore scheduler task which CRUDs Sitecore items daily. The data source is from the response of an API endpoint which is managed by another vendor. Recently, no data has been returned. As always, the Sitecore log is valuable to check for root causes and from the logs, we can see that the API endpoint is not available for an unknown reason.
As our Sitecore instance is behind a proxy server, there has been a case that the endpoint is whitelisted incorrectly somehow on the hosting provider end. Learning from past experience, we double checked with the hosting provider and everything looks OK so we informed the API vendor of the problem.
When the endpoint is available as informed by the API vendor, we want to verify it immediately so that we’re gonna have a good chance to resolve any issues quickly. Of course, we can run the scheduler task manually and then have a look at the Sitecore log. However, in this case, we should not do that as there are around 30K Sitecore items involved and there might be “a complaint” from the hosting provider for high DB CPU utilization during “rush hour” (this is also why we always let the task run at midnight). Long story short, we should develop a handy tool for testing the endpoint from behind a proxy server.
Besides, the tool should be helpful as the team members don’t have to travel to the data center to check other API endpoints on some special cases such as bad data-returned, operation timeout-reached, etc
Assumptions
- developing a handy tool which is able to get the response of a specific endpoint from behind a proxy server by creating a custom Sitecore admin page and ensuring it to inherit Sitecore.sitecore.admin.AdminPage then calling the CheckSecurity method, learn more about it
- making the proxy server settings configurable such as host name, port, credential, etc
- being able to disable proxy server settings as well
Personally, I wanted to play around with PackageReference in order to build and deploy my Get Endpoint Response Sitecore module successfully based out of various Sitecore versions (you know, I’m a super lazy developer so I don’t want to create multiple Visual Studio projects for multiple Sitecore versions)
How to install Get Endpoint Response module
Download this Sitecore package and then install it to your Sitecore instance via Installation Wizard
Note: you can download it from Sitecore Marketplace as well
How to use the module
- open \App_Config\Include\z.Vhs.GetEndpointResponse.config and then update the proxy server settings
- open a browser and then navigate to /sitecore/admin/GetEndpointResponse.aspx
- Note: you’re gonna be redirected to Sitecore login page if have not logged into Sitecore yet
- enter the endpoint to Endpoint URI text box and then click Get Response button
Note: you may want to disable proxy server settings if it’s unnecessary
- open \App_Config\Include\z.Vhs.GetEndpointResponse.config
- set Enabled to false
Not Good Enough? Please feel free to download the source code and add your own enhancements if necessary.
Got issues?
Please send your issues (with screenshots if possible) to viet.hoang.sitecore@gmail.com so that I have a chance to understand your problem and be able to suggest the solution.
Happy Sitecore Coding!