API Automations

What is API?

It stands for Application Programming Interface where applications are interacting to various functionality to reach the resources and return the resource request to the user.

Authorization and Authentication

Question: – What is the difference between Authorization and Authentication?

Answer: –

Authentication refers about the identity of the user. There are different way to authenticate. There are various authentication tecjniques

  • One Way : – Only using Username, and Password
  • Two Ways – UserName+Password , then phone, or Email
  • Three ways : – UserName+Password + phone, or Email then facial recongnition

Authorization refers the permission to do the operation. Mostly this authorization will be granted through automatically generated Token. The token is generated a combination of different details that could let the key to be unique to get the access for any available operation and resource.

What are the API Methods?

There are different method in the API requests. The know and mostly used API methods representing CRUD are the following

Question: – What are the possible method?

Answer:

  • GET – Reading resource
  • POST – Creating a new resource
  • PUT – Updating an existing resource
  • DELETE – Delete an exiting resource.

API Tools

There are various tools used to work with API. The tools are used to design, develop and work within a team to share our resources. Some of the known bools to let us work with API are the following

Question: – What tools you know for API activity?

Answer:

  • postman
  • apigee
  • JMeter
  • and many more

Figure 1.1 – Different Tools For API

API Elements

An API is made of different elements that could let to do a successful call. The following are some of the elements

Question: – What things are required to do an API call?

Answer : –

  • URL – Uniform Resource Locator
  • Parameters let us to pass what to include in the call
  • Token – Valid token let us to get authorisation
  • Headers are additional info to include with the call.
  • Body defines input to be used in the call.

Mock Server

It is a part of API design, development, as well as testing which could let us to simulate the call, and the response an API. A mock server simulate call, response, status code, and all the validation that we suppose to have in a real API call.

Question: – To set up a Mock server, what are the important elements should be defined?

Answer: –

  • Method
  • URL
  • Response of the Call and/or Body
  • Status Code

Figure 1.2 – Mock Server

Status Codes

There are various status code that could let us to determine the kind of operation or the response of the operation. The common known status codes are the following

Questions : – What are the know code status in API calls?

  • 2.x.x – Success meaning client request accepted successfully.
    • 200 – OK
    • 201 – Created
    • 202 – Response has been accepted to process
    • 204 – Not Content
  • 3.x.x – Redirections meaning client should do extra actions to complete the request.
  • 4.x.x – Client Errors meaning errors happen due to a client not correctly do the request.
    • 400 – Bad. request
    • 401 – UnAuthorized
    • 404 – Method Not Found
  • 5.x.x – Server Errors meaning error happen. due to server issues,
    • 500 – Internal Server
    • 503 – Service Unavailable
    • 504 – Timeout Exception
Scroll to Top