November 2020 Summaries
8 posts from Rapid
Filter
Month:
Year:
Post Summaries
Back to Blog
The IPMon REST API is a robust and scalable solution built using Node.js, Express.js, and MongoDB. It provides a real-world implementation of a REST API with a database that persists data across server outages. The API endpoints remain the same as in the previous version, but now they are handled by an Express.js server. The API uses a web framework to handle HTTP requests and responses, making it more readable and maintainable. The MongoDB database is used to store IP address records, providing persistence of data. The API also includes utility modules for common tasks such as parsing, response formatting, error handling, and many more. The Express.js server listens on port 4000 and initializes the project by creating a directory named 'node-api' and initializing a new Node.js project with the default configuration. The `initialize` function is called when the server starts, which sets up the MongoDB client and defines API endpoints using Express.js methods. The `handleCreate`, `handleUpdate`, `handleShow`, `handleRead`, and `handleDelete` functions are used to handle requests to the API endpoints. These functions call internal helper functions such as `getGeolocation`, `insertRecord`, and `updateRecord`. The `getGeolocation` function is used to call the IP GeoLocation API to retrieve location details for each IP address, while the `insertRecord` and `updateRecord` functions are used to insert and update IP address records in MongoDB. With this implementation, the IPMon REST API service is complete, and it can be tested by running the 'server.js' file and using cURL utility to verify all API endpoints.
Nov 24, 2020
2,306 words in the original blog post.
The IPMon API interface is a RESTful API designed using Node.js that provides a simple way to track and manage IP addresses for geolocation purposes. The API has endpoints for creating, reading, updating, and deleting IP address records, as well as showing all tracked IP addresses. It relies on the RapidAPI service for fetching IP address details from its geolocation API. The API uses a Map object to store IP address data in memory, which is replaced by a real database component in the second part of this post.
Nov 24, 2020
3,432 words in the original blog post.
WordPress and React can be combined to create a powerful web application. WordPress provides an easy-to-use content management system, while React provides a modern JavaScript framework for building user interfaces. Gatsby is used as a static site generator to compile React code and data into static assets. GraphQL allows developers to query data from the WordPress site in a flexible and efficient way. By combining these technologies, developers can create fast-loading web applications with a rich set of features and plugins. The tutorial provides step-by-step instructions on how to use WordPress with React, including setting up local hosting, creating a GraphQL API, pulling data into Gatsby, and adding styling to the application.
Nov 20, 2020
3,003 words in the original blog post.
The Google News API is a service that can be used to analyze news data and understand public awareness of topics, such as presidential elections. To use the Google News API with Python, one must first install Python, obtain an API key, subscribe to the API, and then write code to connect to the API and retrieve search results. The retrieved results are in JSON format and can be processed using Python libraries such as `http.client`. A sample script is provided that pulls articles from the Google News API, counts the frequency of keywords in article titles related to presidential candidates, and saves the results to a local CSV file. The code also includes a batch file to run the script hourly, allowing for the collection of data over time. Once the election is over, the collected data can be charted using Excel or other graphing tools to visualize trends and correlations between media exposure and vote counts.
Nov 17, 2020
1,800 words in the original blog post.
The article details a step-by-step guide for building a simple sports scoreboard website using Ruby and the Sportspage Feeds API, with a focus on major US leagues such as the NFL, NBA, MLB, NHL, NCAAF, and NCAAB. By leveraging the comprehensive data provided by the Sportspage Feeds API through RapidAPI, developers can access detailed information about teams, games, and scores, avoiding the need to source data from multiple platforms. The tutorial outlines the setup process, including necessary tools and frameworks like Ruby, Sinatra, Excon, and Bootstrap, to display a list of leagues and their respective games on a single webpage. The guide also includes instructions on fetching game data, displaying scores, and enhancing the user interface with period-specific scores, while encouraging developers to handle various game states such as upcoming or live games.
Nov 17, 2020
1,807 words in the original blog post.
Table of ContentsWhat is API Analytics?Why Collect Qualitative Analytics?Why is API Analytics Important?API Analytics ExampleWhat is RapidAPI for Teams?How to Track API Analytics & Monitor API UsageSubscribe to APIsExplore API AnalyticsManage API UsageView API ParametersConclusionFAQWhat are some common types of analytics?Does Google Analytics Have an API?What are some Google Analytics API Alternatives?What is API Analytics?[Analytics] is used for the discovery, interpretation, and communication of meaningful patterns in dataWikipediaAnalyzing data can determine the relationship between different parts of data and whether patterns exist. However, there are different ways to analyze data based on the type and origin. Therefore, the analyst has to choose a certain analysis to perform. This is preferably one that fits the type of data they have collected.The two main types of data are qualitative or quantitative.Generally speaking, qualitative data can be an observation that is good, bad, colorful, tall, strong, etc.Quantitative data are observed as numbers.A qualitative analyst at an art show may describe the quality of a painting by observing it then writing down words. In contrast, a quantitative analyst may measure the dimensions of the paintings and record numbers.API analytics are all the ways that we can record qualitative and quantitative data from our API requests to be used in a meaningful way.If we wanted to know how long an API request took, we could measure the latency. Latency is the time interval between events. Computers can do things pretty quickly, so this is usually measured in milliseconds (ms.).Why Collect Qualitative Analytics?Despite the importance of quantitative data in API analytics qualitative data plays an important role. An example of qualitative data in API analyses is the HTTP method of the request.Additionally, you can use qualitative data to help categorize quantitative data. For example, a user is complaining that a certain action on their app takes a long time. In your analysis, you notice that a POST request (a type of HTTP method) is sent when the user performs the action and that it has an abnormally high latency. In this simple example, the use of both qualitative and quantitative API analytics produced a meaningful discovery in the data.Try RapidAPI for TeamsWhy is API Analytics Important?The importance of API analytics is inferred from the simple example at the end of the previous section. If someone collects analytics, they could use the analytics to describe, diagnose, prescribe, or predict patterns in the data.These analytics have the power to solve real-world business problems that have a monetary impact on the organization.API Analytics ExampleTo give a concrete example, an organization or developer subscribes to an API and, depending on its pricing, is given a quota. The plan costs $100 per month and allows for 10,000 API requests a month, but any requests over that quota incur a cost of $0.10 per request.This can be interpreted to mean that any requests over the quota cost ten times more than the requests under the quota.If the team manager receives an invoice that has an overage cost of $88 at the end of the month, they are going to want to know;Who sent the 880 extra requestsWhy there were so many requestsWhat they can do to solve this problemRapidAPI allows API subscriptions and usage to be divided at the organization, team, application, or API level.Consequently, determining who sent excess requests is a simple task. You can pinpoint the requests down to the application.Next, using RapidAPI’s analytics, you can view;when the requests were sentwhat the endpoint waswhich HTTP method was usedthe parameters for each requestAll of these analytics help you determine why the requests were sent.Determining what can be done is not as straightforward. There may be a rogue HTTP request function that keeps retrying on failed requests despite incorrect parameters. Another possibility is that the application saw an unexpected increase in users, which means that the forecasted requests were insufficient.One scenario is solved by fixing the bug in the code, another is solved by upgrading the subscription plan to handle the increase in use.Either way, the importance of collecting API analytics is clear!Try RapidAPI for TeamsWhat is RapidAPI for Teams?RapidAPI for Teams is a way for an organization to manage API usage across the previously mentioned segments; teams, applications, APIs, and requests.In addition to monitoring API usage, RapidAPI for Teams allows for publishing and securing internal APIs. When publishing, the team can decide if they want to use RapidAPI’s integration with OpenAPI to publish API specifications.RapidAPI for Teams tracks quota usage per API and lets users quickly pinpoint weak points in there application or API. Furthermore, it provides a clean way to view your application’s network activity.How to Track API Analytics & Monitor API UsageFirst, to track API analytics across APIs you need to sign up for RapidAPI for Teams. Visit RapidAPI and select Create Organization in the navigation bar, and don’t worry, it’s free to create an organization.After creating your organization, visit the Organization Dashboard. Here, you can invite users, create new teams, etc. You can explore the side navigation or learn more about each tab in the complete dashboard tutorial.Next, create an example team, in addition to the default team that was created for you. This is done on the Manage Teams tab. I have named my second team “Other”.Try RapidAPI for TeamsSubscribe to APIsIf you are new to RapidAPI, the API marketplace is where you can discover, subscribe, and test external APIs.Search for the Mashvisor API and visit the pricing page. This page displays subscription plans for the API. You need a credit card on file with the organization to subscribe to some APIs.Notice there is a dropdown on the pricing page to select the account that is making the subscription.Subscribe to the Mashvisor API on both team accounts within the organization.Then, go back to the endpoints tab.On the endpoints dashboard, you can select the team and application that you wish to test the endpoint from. Send 2-5 test requests from different endpoints on each of the two teams that you have using the Test Endpoint button to send the request. This will give us some data to view on the dashboard.Feel free to subscribe to other APIs, sending more requests, if you want to add more data to view in the dashboard. However, be aware of quotas and pricing plans.Explore API AnalyticsNow that we have some data to explore, click on My Apps in the top navigation bar.The initial dashboard view gives us an immediate look into an API segment. The default view takes a look at total API calls for all the applications of the selected team.Next, select the default application, and in the dropdown, choose the Analytics tab. This will segment the API calls into the requests coming from this application.Here, you can segment your application requests by adding or removing APIs from the interactive input element above the chart.After selecting the application analytics, you have the option to filter by the endpoint, but you can only view endpoint analytics one API at a time.Therefore, remove any other APIs from the interactive API element except for the Mashvisor API. Then, in the endpoint search box, select one of the available endpoints.It’s also important to note that whenever you segment the dashboard by a team, application, API, or endpoint the total API calls, error rate, and latency automatically adjust.Finally, at the bottom of the dashboard, there is a sortable table that provides organized details on each request.You can export different table analytics, or the entire dataset, as a CSV file to perform your analysis with a different tool or store the data locally.Try RapidAPI for TeamsManage API UsageIt can sometimes be difficult to know how much of your API quota has been used. A single developer may be able to keep an eye on their application’s usage, but that luxury changes with scale.In the previous section, we discussed viewing API usage within a team and by the application. You can also view API usage across teams. This is useful when two teams are subscribed to the same API.Navigate back to the Organization Dashboard, using the top navigation bar, and select the Subscriptions & Usage tab on the left menu.Notice that your subscriptions to different APIs are listed here. If you have a paid subscription plan with the API you can select that row in the table to glimpse some analytics.Once clicked, you can hover over different bars on the chart to view how many API calls each team has made to this API.Remember, this is a good place to view usage by team and quotas across all of your APIs. However, you can also view API usage by application and endpoint on the My Apps page.View API ParametersEarlier, I pointed out a table at the bottom of the dashboard on the My Apps page. The table has sorting capabilities and allows a user to export API analytics in bulk. Additionally, the table holds details on each request. The details contain metadata about the request and query parameters submitted as part of the request.Let’s say that I noticed a few errors in my API analytics for the Mashvisor API, and I wanted to explore the cause. I navigate to My Apps and shrink my analytics criteria so I am viewing the application and API that is producing the errors. Furthermore, I sorted the table to view only API requests that returned a status code in the 400s or 500s.I now can click on the individual details of each failed request to view the parameters. Subsequently, I can view the request parameters and the response object.Nothing seems out of the ordinary with the request parameters.However, the response message informs me, “no connection found for given state mu”. After a bit of research, I discover that the endpoint needs to receive a valid U.S state abbreviation when searching for properties and “mu” is not a valid abbreviation for any state.It quickly becomes apparent that this endpoint is not validating parameters and wasting the API quota!The example is simple, but being able to quickly view individual request parameters, request headers, response object, and response headers will save you time in diagnosing API troubles.Try RapidAPI for TeamsConclusionData is powerful when working with computers and networks. Tracking API analytics can help solve problems and save money by making API management easier. Having an overview of external and internal API usage increases the chance that you will notice bottlenecks and increase application efficiency.FAQWhat are some common types of analytics?Prescriptive analyticsPredictive analyticsDescriptive statisticsDoes Google Analytics Have an API?Google offers a series of analytics APIs that developers can access. View three of the reporting APIs by following this link.What are some Google Analytics API Alternatives?You can find some here at https://rapidapi.com/blog/top-analytics-apis/
Nov 13, 2020
1,982 words in the original blog post.
You can access and utilize the Kairos API by following these steps: First, sign up for a RapidAPI account and subscribe to the Kairos API. Then, use the API's endpoints to detect faces in images, enroll faces into galleries, recognize faces in new images, and more. The API provides a simple and efficient way to implement face recognition and categorization features in your applications. With a generous free tier that includes 1000 requests per month, you can start building face recognition capabilities without breaking the bank.
Nov 11, 2020
2,573 words in the original blog post.
Testing an API, particularly a RESTful API, is crucial for developers and clients to ensure that it works as expected. To test an API, first define its structure and requirements by exploring documentation and making hypotheses about its functionality. Next, create test cases to check critical functionality, including boundary cases and error scenarios. Tools like Postman can help with testing, but RapidAPI offers a more comprehensive solution, allowing users to choose from various APIs, view latency and success rates, and generate code for integration. By performing tests and using tools like RapidAPI, developers can identify issues, explore hypotheses, and ensure that their API is working correctly before implementing it in production.
Nov 10, 2020
1,467 words in the original blog post.