{"id":35065,"date":"2016-05-30T17:49:56","date_gmt":"2016-05-30T12:19:56","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=35065"},"modified":"2016-05-30T17:49:56","modified_gmt":"2016-05-30T12:19:56","slug":"api-testing-using-rest-client","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/api-testing-using-rest-client\/","title":{"rendered":"API TESTING USING REST CLIENT"},"content":{"rendered":"<p><span style=\"text-decoration: underline\"><strong>What is API?<\/strong><\/span><\/p>\n<p>API stands for Application Programming Interface. It is a software-to-software interface, not a user interface. With APIs, applications converse with each other with no client learning or intervention.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>API Workflow Example<\/strong><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-35066\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/05\/versa.png\" alt=\"versa\" width=\"625\" height=\"258\" \/><\/p>\n<p><span style=\"text-decoration: underline\"><strong>What is API Testing?<\/strong><\/span><\/p>\n<p>API testing utilizes programming to send calls to the API and get the results. It regards the segment under the test as a black box. The primary objective of API testing is to confirm correct execution and failure treatment of all the APIs (if any) preceding its coordination into an application.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>REST API<\/strong><\/span><\/p>\n<p><strong>REST<\/strong><strong>: Representational State Transfer<\/strong><\/p>\n<ul>\n<li>It\u2019s an arrangement of functions on which the testers perform requests and receive responses. In REST, API interactions are made via HTTP protocol.<\/li>\n<li>REST also permits communication between computers with each other over a network.<\/li>\n<li>For sending and receiving messages, it involves using HTTP methods, and it does not require a strict message definition, unlike web services.<\/li>\n<li>REST messages often accept the form either in the form of XML, or JavaScript Object Notation (JSON).<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline\"><strong>4 Commonly Used API Methods<\/strong><\/span><\/p>\n<ol>\n<li><strong>GET<\/strong><strong>: <\/strong>It provides read-only access to a resource.<\/li>\n<li><strong>POST<\/strong><strong>: <\/strong>It is used to create or update a new resource.<\/li>\n<li><strong>PUT<\/strong><strong>: <\/strong>It is used to update or replace an existing resource or create a new resource.<\/li>\n<li><strong>DELETE<\/strong><strong>:<\/strong> It is used to remove a resource.<strong>\u00a0<\/strong><\/li>\n<\/ol>\n<p><span style=\"text-decoration: underline\"><strong>REST API Inputs<\/strong><\/span><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-35073\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/05\/Rest.png\" alt=\"Rest\" width=\"636\" height=\"232\" \/><\/p>\n<p><span style=\"text-decoration: underline\"><strong>Example:-<\/strong><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-35074\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/05\/Get.png\" alt=\"Get\" width=\"865\" height=\"425\" \/><\/p>\n<p><strong>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/strong><span style=\"text-decoration: underline\"><strong>Fig. GET Method Example<\/strong><\/span><\/p>\n<p><strong><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-35075\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/05\/POST.png\" alt=\"POST\" width=\"876\" height=\"433\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong><\/p>\n<p><strong>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/strong><span style=\"text-decoration: underline\"><strong>Fig. POST Method Example<\/strong><\/span><\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p><span style=\"text-decoration: underline\"><strong>HTTP Response Codes<\/strong><\/span><\/p>\n<p><strong>Some HTTP response codes, which are often used with REST<\/strong><\/p>\n<p><span style=\"text-decoration: underline\"><strong>200 OK<\/strong><strong>: &#8211;<\/strong><\/span> This code indicates that the request was made successful.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>201 Created: &#8211;<\/strong><\/span> This code indicates that request was successful, a resource was created, and it validated the success of a PUT or POST request.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>400 Bad Request: &#8211;<\/strong><\/span> This error code happens with POST and PUT requests when the data does not pass validation, or the passed data is in the wrong format.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>404 Not Found: &#8211;<\/strong><\/span> This code indicates that the required resource could not be found or not available.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>401 Unauthorized: &#8211;<\/strong><\/span> This error code indicates that you need to provide authentication before accessing the resource.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>405 Method Not Allowed: &#8211;<\/strong><\/span> Method Not Allowed error indicates that the requested HTTP method is not supported for this resource.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>409 Conflict: &#8211;<\/strong><\/span> This code indicates that the user created the same resource twice by which conflict occurs.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>500 Internal Server Error: &#8211;<\/strong> <\/span>Due to server-side issue, this error code occurs.<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p><span style=\"text-decoration: underline\"><strong>Common Types of Tests and Bugs in API Testing<\/strong><\/span><\/p>\n<ul>\n<li>Delayed in API Response time<\/li>\n<li>To verify when API doesn\u2019t return any response data.<\/li>\n<li>Response Data is not structured<\/li>\n<li>Difficulty in connecting and getting response from API<\/li>\n<li>Output response should be checked by input request provided.<\/li>\n<li>Verification of the API whether it triggers some other event or request another API<\/li>\n<li>Verification of the API whether it is updating any data structure<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline\"><strong>Advantages of API Testing<\/strong><\/span><\/p>\n<ul>\n<li>It is time effective.<\/li>\n<li>It is language independent.<\/li>\n<li>It is quite helpful in testing Core Functionality.<\/li>\n<li>It helps us to reduce the testing cost.<\/li>\n<li>It helps us to reduce the risks.<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline\"><strong>Challenges of API Testing<\/strong><\/span><\/p>\n<ul>\n<li>Parameter Combination, Parameter Selection, and Call Sequencing are three major challenges in API testing.<\/li>\n<li>Due to the absence of GUI, it is quite difficult to provide input values.<\/li>\n<li>Parameters selection and categorization required must be known to the tester.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is API? API stands for Application Programming Interface. It is a software-to-software interface, not a user interface. With APIs, applications converse with each other with no client learning or intervention. API Workflow Example What is API Testing? API testing utilizes programming to send calls to the API and get the results. It regards the [&hellip;]<\/p>\n","protected":false},"author":737,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":90},"categories":[1,1816],"tags":[2081,323,1061,1821],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/35065"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/737"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=35065"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/35065\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=35065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=35065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=35065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}