Posts Tagged ‘API’

Importance of APIs in the World of Social Media

Tuesday, June 30th, 2020

You have probably heard of the acronym tossed around in recent years. API is the acronym for Application Programming Interface which is a set of instructions, standards, or requirements that enables a software or app to employ features/services of another app, platform, or device for better services. Concisely, it’s something that lets apps communicate with each other. One of the major aspects of API is that it has made the internet experience much more pleasant for every person. The acronym has helped you compare the best prices for flights, allowed you to embed a map into your store’s website, and even seamlessly processed your credit card payments. If you want to explore more of it, then this blog will give an overview of APIs and how they relate to social media platforms.

Role of APIs for Social Media

Social media has exploded in recent years. Today, the number of people on social media has grown to nearly 3 billion, and the numbers are projected to continue their upward trend. As we know, there are numerous platforms, from Facebook, Instagram to Twitter, Imgur to Foursquare, and more, cater to a remarkable range of digital interactions to people around the world. 

APIs make social media possible and they are crucial to successfully exchanging all of this information and delivering the experience that users expect. Without APIs, it would be difficult for your website to link your Facebook page or Twitter account to your website or to combine your Google Plus account to your blog posts in order to promote your authorship reputation. In like manner, you will not be able to use the Google Analytics tool in auditing and optimizing your e-commerce website for better search performance. The social media marketing tools that are used in encouraging businesses are powered by APIs. As far now, there are many marketing values that are derived from social media APIs which include but not limited to the following:

  • Showing ad campaigns to your site as a publisher.
  • Application development to expand the benefits of using marketing tools.
  • Displaying social media buttons to optimize the social shares of your post.
  • Seamless launching of an email marketing campaign using APIs for customer subscription lists and ad campaigns.
  • Tracking down the data analytics information from your website to the analytic monitoring tool or software.

Big Examples of Social Media API Functionalities

As mentioned above, APIs are being used in countless ways by every social media platform today. Here are a few popular examples:

Facebook Graph API:

At present, Facebook is the world’s largest social media platform, with more than 2.4 billion active users worldwide. The Facebook Graph API is an HTTP-based API that provides the main way of accessing the platform’s data. Third-party developers and creators use this tool to retrieve information such as username, email, birthday, and hometown of users. Besides, popular chains such as Subway and Starbucks use the Graph API to collect user information to assist in their marketing and advertising strategies.

Twitter Ads API: 

The Twitter API mainly allows you to add Twitter functionalities to your application. Moreover, the Twitter Ads API is a key part of their business; it not only helps promote Twitter accounts but also allows organizations to launch their scheduled advertising campaigns. With the help of API, marketers can reach out to people of a certain age group from a certain city. From one ad account, an organization can roll out about 200 active advertisement campaigns.

Imgur API: 

Imgur is another amazing social media platform where people share entertaining images. It has a global user base with high engagement, and these users are particularly interested in technology, video games, food, and music. Brands outside of Imgur can utilize its API functionality to expose these users to new gaming and tech items and products. Currently, Imgur offers its third version of APIs which use OAuth 2.0. Therefore, you won’t have to encrypt your requests, but simply send them to https:// via SSL/TLS. 

LinkedIn API:

LinkedIn can be described as the world’s number-one social network for business users. It was established in 2003, and currently serves millions of users in more than 200 countries worldwide. LinkedIn also offers API access to developers (RESTful), so that all contacts, jobs, relationships, companies, and interactions would be displayed by third-party providers. Likewise, there are many more: Instagram, Reddit, Snapchat, and other social media brands all have created APIs. These APIs will act as potent technologies supporting the ever-expanding promise of social media.

Conclusion

With the aforementioned information, I hope you will find an API that you can use to add versatile social engagement capabilities to your applications! For more information, you can connect with our business consultants. 

API Automation with Rest Assured

Monday, June 29th, 2020

Introduction of Rest API

Rest-Assured is a Java-based library that is used to test RESTful Web Services. We can build a customized HTTP Request to send to the Restful server. This allows us to test a variety of Request permutations and in turn test various combinations of main business logic.

Rest-Assured library also provides the capability to authenticate the HTTP Responses accepted from the server. For e.g. we can verify the Status code, Status message, Headers and even the body of the response.

What is Rest Assured?

REST Assured library is the best tool to automate your rest api’s. Rest Assured has a gherkin type syntax.

List of few Rest Assured features:

  • DSL-like syntax
  • XPath-Validation
  • Specification Reuse
  • Easy file uploads 

All these features support in handling api tests in a very well managed way.

Why Are We Using Rest Assured?

REST Assured offers a number of other useful features for writing tests for RESTful APIs. Let’s take a look at some of them.

  • Technical response data validation
  • Data-driven testing
  • Support for authentication mechanisms

The benefits of REST Assured

Aspects of REST Assured which makes it a most appropriate library for API testing:

  • In traditional development we have to write a large amount of code to set up http connection, send a request and receive and parse the response, while with the rest assured a lot of boilerplate code is not required to be written.
  • Since REST Assured is a Java library, integrating it into a continuous integration / continuous delivery setup is a breeze, especially when combined with a Java testing framework such as JUnit or TestNG


Challenges behind API Automation Testing:

Initial Setup

Foremost obstacle in any automation testing is initial setup. If the initial setup is too much complicated, then enthusiasm goes down as the time passes. Most people, even companies, put automation testing on hold or leave in the middle and proceed with the manual testing. This is one of the major blockers in automation of the testing process. If initial setup is easy-going, then implementation of the testing framework / tool will be much easier and highly achievable.

Maintenance

Second major barrier is maintenance. Once you have created your test suites for any release. Then the query comes in your mind, is it easy to maintain those test suites over a period of releases? If improving those test suites takes a good amount of effort, then it is worse than the manual testing. If upgrading time is less than we can easily maintain those test suites.

Management

Third obstacle is management and is to some extent related to maintenance. Management makes the tasks of organizing test suites easier and more maintainable. If you have linked your API test cases with API Specifications, then proper management can give you answers to the questions like whether your API is fully tested or not.

Skilled Resources

Fourth hurdle is skills required to use the library / tool. If we adopt a tool / library, then we should have people having those skills set required for the usage of the tool. In the range of REST API, we can benefit from the tools in which no technical skills are required to validate REST APIs because REST APIs are platform independent and language agnostic.

Integration with existing ecosystem

Fifth hurdle is integration with the existing ecosystem. It is important to know how well the library / tool integrates with your build or defect tracking system (or any other). Whenever you prepare a new build, it should fire the automated test suite first and if all the test cases pass, only then the build is ready to be released in the market. And if the validation fails, then your automated test suite should automatically log bugs against the failed test cases.

Status Codes in API Testing

Friday, June 19th, 2020

What is API?

API is an Application Programming Interface. It is an interface among software and within the software. To understand it we must go through a basic example as a user.

To get to know the API, follow the below steps:

  • Let us suppose a user is on ‘You Tube’ and observes the URL field on the screen. If a user enters any keyword for which the user wishes to view the video, say ‘Hello’ and click on the search button. The API of the videos related to’ hello ‘will get hit and users may observe the part after youtube.com/{This}.
  • If the user clicks any video from the page again, he/she will observe the API’s being hit at that moment. So, what is basically happening here?
  • The user is requesting a request from a provider and it is giving back the required response. Some of the times it happens that there is a working site say ‘www.ABC.com users search it and its API gets hit, it opens.

What are Status Codes?

  • Now if the company ‘ABC’ changes its name to ‘ABD’ and the user enters the same old URL which has not yet been redirected to the new company name it will show an error ‘Page not found‘.
  • How can users view it? For more understanding, right-click on the screen, Select ‘inspect’ and click on the ‘console’ tab. It will display a 404 page not found. These results tell us the responses are known as status codes.

Status Codes are the HTTP RESPONSE standard status code.

What are some common API status codes?

Status codes are divided into 5 categories:

  • 1xx – Informational messages
  • 2xx – Success messages
  • 3xx – Redirection messages
  • 4xx – Client error
  • 5xx – Server error

To understand categories of status codes in API’s testing, let us think of a way the user can easily catch. Consider a website, the screen user can view with the eyes is the user interface.

On this website, there is a page where the user can add its details to create the account.

Users enter fields such as ‘Name’,’ DOB’ (and other personal details) and click on ‘Submit’. Now considering the above scenario, we can understand status codes.

  • If during the submit request, which was received and understood. It requests the response consuming resource to wait for a final response. Just an information message while the request continues to proceed are Information messages.
  • When the request is requested by the client was received, understood and accepted. It states as Success messages.
  • If while entering the Name field which has a validation to accept only 15 alphabets, user-entered more than that and submit the request. On the UI, an error message is displayed. Now, this error was caused by the client. hence Client error.
  • If during the submit request, the server is unable to perform the request due to any situation, that is known as Server-side error.
  • For a Redirection message, the website name changes its name to ‘www.AND.com’ and you enter the same old URL which has not yet been redirected to the new website name, this is the case for redirection found.

Conclusion

APIs are a means by which two different programs can communicate within the software and among software’s and status codes are the responses that are the results of the requests sent.

What is an API?

Thursday, June 4th, 2020

API is an acronym for Application Programming Interface.

It enables communication and data exchange between two separate software systems. A software system implementing an API contains functions/subroutines which can be executed by another software system.

What is API Testing?

API Testing is entirely different from GUI Testing and mainly concentrates on the business logic layer of the software architecture. This testing won’t concentrate on the look and feel of an application.

Instead of using standard user inputs(keyboard) and outputs, in API Testing, you use software to send calls to the API, get output, and note down the system’s response.

API Testing requires an application to interact with API. In order to test an API, you will need to

  • Use Testing Tool to drive the API
  • Write your own code to test the API

Set-up of API Test environment

  • API Testing is different from other software testing types as GUI is not available, and yet you are required to set up an initial environment that invokes API with a required set of parameters and then finally examines the test result.
  • Hence, Setting up a testing environment for API testing seems a little complex.
  • Database and server should be configured as per the application requirements.
  • Once the installation is done, the API Function should be called to check whether that API is working.

Types of Output of an API

An output of API could be:

  1. Any type of data
  2. Status (say Pass or Fail)
  3. Call another API function.

Test Cases for API Testing:

Test cases of API testing are based on:

  • Return value based on input conditionit is relatively easy to test, as input can be defined and results can be authenticated.
  • Does not return anythingWhen there is no return value, the behavior of the API on the system to be checked.
  • Trigger some other API/event/interruptIf an output of an API triggers some event or interrupt, then those events and interrupt listeners should be tracked.
  • Update data structureUpdating data structure will have some outcome or effect on the system, and that should be authenticated
  • Modify certain resourcesIf API call modifies some resources then it should be validated by accessing respective resources.

Approach of API Testing

Following points helps the user to do API Testing approach:

  1. Understanding the functionality of the API program and clearly defining the scope of the program.
  2. Apply testing techniques such as equivalence classes, boundary value analysis, and error guessing and write test cases for the API.
  3. Input Parameters for the API need to be planned and defined appropriately.
  4. Execute the test cases and compare expected and actual results.

How to do API Testing

API testing should cover at least following testing methods apart from usual SDLC process:

  • Discovery TestingThe test group should manually execute the set of calls documented in the API like verifying that a specific resource exposed by the API can be listed, created and deleted as appropriate.
  • Usability Testing – This testing verifies whether the API is functional and user-friendly. And does API integrate well with another platform as well.
  • Security TestingThis testing includes what type of authentication is required and whether sensitive data is encrypted over HTTP or both.
  • Automated TestingAPI testing should culminate in the creation of a set of scripts or a tool that can be used to execute the API regularly.
  • DocumentationThe test team has to make sure that the documentation is adequate and provides enough information to interact with the API. Documentation should be a part of the final deliverable

Best Practices of API Testing

  • Test cases should be grouped by test category.
  • On top of each test, you should include the declarations of the APIs being called.
  • Parameters selection should be explicitly mentioned in the test case itself.
  • Prioritize API function calls so that it will be easy for testers to test.
  • Each test case should be as self-contained and independent from dependencies as possible.
  • Avoid “test chaining” in your development.
  • Special care must be taken while handling one-time call functions like – Delete, CloseWindow, etc…
  • Call sequencing should be performed and well planned.
  • To ensure complete test coverage, create test cases for all possible input combinations of the API.

Types of Bugs that API testing detects

  • Fails to handle error conditions gracefully.
  • Unused flags
  • Missing or duplicate functionality.
  • Reliability Issues. Difficulty in connecting and getting a response from API.
  • Security Issues
  • Multi-threading issues.
  • Performance Issues. API response time is very high.
  • Improper errors/warning to a caller.
  • Incorrect handling of valid argument values.
  • Response Data is not structured correctly (JSON or XML).

Tools for API testing

Since API and Unit Testing both target source code, tools/frameworks can be used for their automation.

  • Parasoft SOAtest
  • Runscope
  • Postman
  • Curl
  • Cfix
  • Check
  • CTESK
  • dotTEST
  • Eclipse SDK tool- Automated API testing

Check out top API Testing Tools List

Challenges of API Testing

Challenges of API testing includes:

  • Main challenges in Web API testing are Parameter Combination, Parameter Selection, and Call Sequencing.
  • There is no GUI available to test the application which makes it difficult to give input values.
  • Validating and Verifying the output in a different system is little difficult for testers.
  • Parameters selection and categorization is required to be known to the testers.
  • Exception handling function needs to be tested
  • Coding knowledge is necessary for testers

Conclusion:

API consists of a set of classes/functions/procedures which represent the business logic layer. If the API is not tested properly, it may cause problems not only in the API application but also in the calling application. It is an indispensable test in software engineering.

Optical Character Recognition Implementation

Thursday, January 23rd, 2020

Introduction and background

Optical Character Recognition (OCR) is the technology to read and convert typed, printed, or handwritten characters into machine-encoded text or a format that the computer can manipulate. As a subset of image recognition, it is commonly used as a form of data entry with the input being some sort of printed document or data records such as bank statements, passports, sales invoices, resumes, and business cards.

Android version

For this, the services/APIs which were used for implementation was Xamarin. Google Play Services. Vision, Our team, was successful in this project as the response rate to be expected in less than one second. The system will be able to read the text in grey and red color with a 65 to 75 percent accuracy in grey text and a 90 percent accuracy in red text.

The process flow includes the user opening the camera and placing it above the lock, followed by the camera detecting the surface. After this, it captures the text and returns the value after processing it.

The Android version of the application can have a custom camera that will capture the video stream of the lock, then divide it into frames, capture the text, and adding it into a list of text. This cycle will repeat until two texts are found to be similar. This procedure will increase the chances of correct detection of the lock instead of just capturing the image, detecting the text within the captured image, and then presenting the output. However, it will also affect the processing time/response rate of the complete operation.

The more efficient working of the application will depend on the latest version of the Xamarin.GooglePlayServices.Vision

iOS version

For the iOS version, the services/APIS used for implementation was text recognition. ML Kit’s text recognition APIs can help you recognize any Latin-based language. This translates into the automation of data entry for receipts, credit cards, and business cards.

With a response rate of less than one second, the system has the ability to read the text in grey and red color. With grey text, the accuracy is at 60 to 70 percent, while the red text is at 80 percent.

The iOS version is supposed to have a custom camera that can capture the lock’s video stream, which will be divided into several frames. From the frames, the system will capture the text and adding it to a list of texts. Until two texts are found to be similar, the system will populate it as the lock code does to the user.

One limitation is that accurate capturing of data depends on the lighting condition of the surroundings as well as the condition of the lock.

Recent Posts

Recent Comments

Get In Touch

Ask Us Anything !

Do you have experience in building apps and software?

What technologies do you use to develop apps and software?

How do you guys handle off-shore projects?

What about post delivery support?