{"id":21814,"date":"2024-04-29T12:32:01","date_gmt":"2024-04-29T16:32:01","guid":{"rendered":"https:\/\/qxf2.com\/blog\/?p=21814"},"modified":"2024-06-10T02:16:04","modified_gmt":"2024-06-10T06:16:04","slug":"api-endpoint-monitoring-using-sematext","status":"publish","type":"post","link":"https:\/\/qxf2.com\/blog\/api-endpoint-monitoring-using-sematext\/","title":{"rendered":"API Endpoint monitoring using Sematext"},"content":{"rendered":"<p><a href=\"https:\/\/qxf2.com?utm_source=api_endpoint_monitoring_using_sematext&#038;utm_medium=click&#038;utm_campaign=From%20blog\" target=\"_blank\" rel=\"noopener\">Qxf2<\/a> had a request to help identify a tool for monitoring API endpoints in one of our client engagements recently. The client wanted a tool with a UI, intuitive configuration and easy maintenance to monitor their changing API endpoints. Additionally, we needed to be able to verify a response body as part of monitoring the endpoint. Our usual tool belt of Prometheus with Grafana was going to be too heavy for this task. So we had to look out for lightweight monitoring tools that suited this specific context.<\/p>\n<p>We found <a href=\"https:\/\/sematext.com\" target=\"_blank\" rel=\"noopener\">Sematext<\/a> &#8211; a platform that offers powerful <a href=\"https:\/\/www.ibm.com\/topics\/synthetic-monitoring\" target=\"_blank\" rel=\"noopener\">synthetic monitoring<\/a> tool to monitor a HTTP endpoint every n interval and display the results on a dashboard. We decided to use this tool to monitor <a href=\"https:\/\/cars-app.qxf2.com\" target=\"_blank\" rel=\"noopener\">Cars API app<\/a> &#8211; an internal app we built to test our API Automation framework before suggesting it to the client.<br \/>\nIn this post, we are outlining the features of Sematext that impressed us, as well as the checks we simulated with our Cars API app to validate if the tool will be a right fit.<\/p>\n<hr>\n<h3> What impressed us? <\/h3>\n<p>In addition to Sematext we were exploring a few other tools too, our experience with setting up and working with those tools made us appreciate these few facets of Sematext. In short, Sematext presented a nice dashboard, worked with different auth types, exposed hooks to third party services like Twilio that made alerting easy and provided an intuitive UI to configure the endpoint monitors.<\/p>\n<p>To give you a taste of Sematext, we have included some screenshots for some of these features.<\/p>\n<h4> 1. Creating a HTTP monitor <\/h4>\n<p>Running an API request &#8211; HTTP method operation against an endpoint in an interval constitutes a <a href=\"https:\/\/sematext.com\/docs\/synthetics\/http-monitor\/\" target=\"_blank\" rel=\"noopener\">HTTP monitor<\/a>. Creating a HTTP monitor on Sematext was very straightforward, we were able to configure one to run a <code>GET<\/code> request against <code>https:\/\/cars-app.qxf2.com\/cars\/find<\/code> endpoint for every 1 minute interval in minutes.<\/p>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/Setting_up_http_monitor.png\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/Setting_up_http_monitor.png\" alt=\"HTTP monitor setup\" width=\"2042\" height=\"816\" class=\"aligncenter size-large wp-image-21818\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/Setting_up_http_monitor.png 2042w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/Setting_up_http_monitor-300x120.png 300w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/Setting_up_http_monitor-1024x409.png 1024w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/Setting_up_http_monitor-768x307.png 768w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/Setting_up_http_monitor-1536x614.png 1536w\" sizes=\"auto, (max-width: 2042px) 100vw, 2042px\" \/><\/a><\/p>\n<h4>2.  Configuring the API request <\/h4>\n<p>Passing input data to the API request can be done through:<br \/>\n&#8211; Header<br \/>\n&#8211; Query<br \/>\n&#8211; Request Body<br \/>\n&#8211; Cookies<br \/>\nWhile these techniques for passing API inputs are common, all the other tools we explored did not support at least one of the above approaches.<br \/>\nWe configured <code>Query parameters<\/code> for the HTTP monitor against the <code>https:\/\/cars-app.qxf2.com\/cars\/find<\/code> Cars API app endpoint.<\/p>\n<h4>3. Auth types supported <\/h4>\n<p>We configured our HTTP monitor to use the <code>Basic<\/code> auth type. Sematext supports the following auth types:<br \/>\n&#8211; Basic<br \/>\n&#8211; Bearer\/Access-Token<br \/>\n&#8211; NTLM<\/p>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_request_data-2.png\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_request_data-2.png\" alt=\"Auth types supported\" width=\"2042\" height=\"930\" class=\"aligncenter size-full wp-image-21877\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_request_data-2.png 2042w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_request_data-2-300x137.png 300w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_request_data-2-1024x466.png 1024w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_request_data-2-768x350.png 768w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_request_data-2-1536x700.png 1536w\" sizes=\"auto, (max-width: 2042px) 100vw, 2042px\" \/><\/a><\/p>\n<h4>4. Response validation <\/h4>\n<p>The response validation offered by Sematext outmatched other tools we explored. It allows creating multiple conditions to validate an API response, the API request was considered failed when any of the condition failed.<br \/>\nWe created 2 conditions to validate the API request made in our HTTP monitor:<br \/>\n1. Check if the response code is 200<br \/>\n2. Verify the response body contains a text<\/p>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_validation.png\" data-rel=\"lightbox-image-2\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_validation.png\" alt=\"HTTP response validation\" width=\"2042\" height=\"930\" class=\"aligncenter size-full wp-image-21821\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_validation.png 2042w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_validation-300x137.png 300w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_validation-1024x466.png 1024w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_validation-768x350.png 768w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/http_monitor_validation-1536x700.png 1536w\" sizes=\"auto, (max-width: 2042px) 100vw, 2042px\" \/><\/a><\/p>\n<h4>5. Monitoring API app on local network <\/h4>\n<p>One of the requirements we had from the client was to help identify a solution to monitor their API app running on their local network. Sematext uses a Docker container running on a server in the local network to make the API calls and validate the response, it then pushes the data to the cloud to make the information available on the dashboard.<br \/>\nWe tested this aspect with our HTTP monitor too, we ran the Cars API Flask app locally, pulled the Sematext Docker container and validated that the monitor data was available on the dashboard in the cloud instantly.<br \/>\n<a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/monitor_API_from_private_network.png\" data-rel=\"lightbox-image-3\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/monitor_API_from_private_network.png\" alt=\"HTTP monitor private network\" width=\"1133\" height=\"342\" class=\"aligncenter size-full wp-image-21825\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/monitor_API_from_private_network.png 1133w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/monitor_API_from_private_network-300x91.png 300w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/monitor_API_from_private_network-1024x309.png 1024w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2024\/04\/monitor_API_from_private_network-768x232.png 768w\" sizes=\"auto, (max-width: 1133px) 100vw, 1133px\" \/><\/a><\/p>\n<p><strong>Note:<\/strong> We had to modify the HTTP monitor endpoint URL to <code>http:\/\/host.docker.internal:5000\/cars\/find<\/code> to monitor the app running on localhost through the Docker container since the container do not have access to localhost. This information was not available on the <a href=\"https:\/\/sematext.com\/docs\/synthetics\/private-locations\/#install-private-agents\" target=\"_blank\" rel=\"noopener\">Private Locations<\/a> guide.<\/p>\n<hr>\n<h3> Features that did not meet our expectation <\/h3>\n<p><strong>Note:<\/strong> This section is very subjective. While many of the Sematext features are remarkable, these were points we discussed when assessing the tool.<\/p>\n<p>It is very hard to find a tool that meets all expectations. Sematext with all its impressive features still lacked in these aspect:<\/p>\n<h4>1. Email notification <\/h4>\n<p>The Email notification triggered when the status of the API endpoint changed &#8211; <code>online\/offline<\/code> was sometimes ~10 mins late. But we were able to work around this by setting up notification hooks. Sematext supports creating hooks to receive notification on these <a href=\"https:\/\/apps.sematext.com\/ui\/hooks\/create\" target=\"_blank\" rel=\"noopener\">apps<\/a>(you need a Sematext account to view this page). Our experience setting hooks to receive notifications on Telegram and SMS using Twilio was pleasant.<\/p>\n<h4>2. Pricing <\/h4>\n<p>The client we were trying to help only had a handful of endpoints, Sematext charges a nominal <code>$2\/month<\/code> for a <code>Pay-As-You-Go<\/code> HTTP monitor but this plan does not allow monitoring the app on private network. Our requirement was somewhere between what was offered in the <code>Pay-As-You-Go<\/code> and the <code>Standard<\/code> plan, but Sematext does offer curating a custom plan, we advised the client to get in touch with Sematext for a flexible plan to suit their need.<\/p>\n<hr>\n<p>We had a positive experience using Sematext overall which lead us to suggesting it to the client.<br \/>\n<strong>Note:<\/strong> Qxf2 Services was not paid to endorse Sematext. This post is based on our experience using the tool.<\/p>\n<h3>Hire testers from Qxf2<\/h3>\n<p>Qxf2 is the home for technical testers. Our QA engineers have a wide range of technical abilities that build upon the solid foundation of testing well. As you can see from this post, our engineer knew of several solutions beforehand and was quickly able to reject them as unsuitable to the client. Instead, they understood the client&#8217;s specific context and went about looking for a solution that fit the client needs. If you want smart testers who take the time to tailor the testing solution to your needs, <a href=\"https:\/\/qxf2.com\/contact?utm_source=api_endpoint_monitoring_using_sematext&#038;utm_medium=click&#038;utm_campaign=From%20blog\" target=\"_blank\" rel=\"noopener\">contact Qxf2<\/a>.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>Qxf2 had a request to help identify a tool for monitoring API endpoints in one of our client engagements recently. The client wanted a tool with a UI, intuitive configuration and easy maintenance to monitor their changing API endpoints. Additionally, we needed to be able to verify a response body as part of monitoring the endpoint. Our usual tool belt [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[417,418,419],"tags":[],"class_list":["post-21814","post","type-post","status-publish","format-standard","hentry","category-api-monitoring","category-http-monitor","category-http-response-validation"],"_links":{"self":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/21814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/comments?post=21814"}],"version-history":[{"count":45,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/21814\/revisions"}],"predecessor-version":[{"id":22218,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/21814\/revisions\/22218"}],"wp:attachment":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/media?parent=21814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/categories?post=21814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/tags?post=21814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}