ServiceNow REST API Interview Questions and Answers

1. Basic Concepts and Terminology

Q1: What is Integration?
A1: Integration is the process of connecting two or more systems to communicate and share data with each other, enabling seamless collaboration between various platforms and services.

Q2: How many types of integrations do we have?
A2: There are two types of integrations:

  • Unidirectional: Data flows from one system to another in one direction.
  • Bidirectional: Data can flow between systems in both directions.

Q3: What is the difference between Unidirectional and Bidirectional API?
A3: In Unidirectional API, data flows in a single direction from one system to another, whereas in Bidirectional API, data can flow in both directions, allowing for communication and updates between systems.

Q4: What is an API?
A4: API (Application Programming Interface) is a set of protocols and tools for building and integrating application software, allowing different systems to communicate with each other.

Q5: How many types of APIs are there?
A5: APIs can be classified into:

  • REST API (Representational State Transfer)
  • SOAP API (Simple Object Access Protocol)
  • GraphQL
  • gRPC

Q6: What is a protocol?
A6: A protocol is a set of rules or standards used to enable communication between different systems or devices. Examples include HTTP, HTTPS, and FTP.

2. REST API Fundamentals

Q7: What is REST API?
A7: REST API is an architectural style for designing networked applications, using HTTP requests to access and manipulate resources. It is stateless and can be used to interact with web services.

Q8: What are the key things involved in REST API configuration? Explain each at a high level.
A8: The key components include:

  • Endpoint: The URL where the API can be accessed.
  • Authentication: Ensures only authorized users or systems can access the API.
  • Method: Specifies the action to be performed (e.g., GET, POST, PUT).
  • Headers: Provide metadata about the request.
  • Body: Contains the data being sent in requests like POST or PUT.

Q9: What is an Endpoint? What is a URI?
A9: An Endpoint is a specific URL where an API service can be accessed. The URI (Uniform Resource Identifier) identifies a resource either by location (URL) or by name (URN).

Q10: What are the types of methods in REST?
A10: The five key methods in REST are:

  • GET: Retrieve data from the server.
  • POST: Send data to the server.
  • PUT: Update or replace an existing resource.
  • PATCH: Modify a part of an existing resource.
  • DELETE: Remove a resource.

Q11: What is the difference between PUT and PATCH?
A11: PUT replaces an entire resource with a new one, whereas PATCH only updates a specific part of the resource.

3. Authentication and Authorization

Q12: What is the difference between Authentication and Authorization?
A12:

  • Authentication verifies the identity of the user or system trying to access the service (e.g., via API keys, OAuth tokens).
  • Authorization determines what the authenticated user or system is allowed to do (e.g., access certain resources or perform specific actions).

Q13: Authentication: Who is allowed to send data to Endpoints?
A13: Only users or systems with valid credentials and tokens are allowed to send data to endpoints, based on the authentication mechanisms in place.

4. Data Handling in REST

Q14: What are the Content Types in REST?
A14: The main content types used in REST APIs are:

  • JSON (JavaScript Object Notation)
  • XML (Extensible Markup Language)

Q15: What is Content in REST?
A15: Content refers to the actual data being exchanged between systems in REST API calls, typically formatted as JSON or XML.

5. REST API Lifecycle and Response

Q16: When you make a REST call, what is the order that the system will check?
A16: The system follows this order:

  • Request: The client sends the request.
  • Authentication: The system verifies the credentials.
  • Method: Determines the action (GET, POST, etc.).
  • Parse: The request is parsed for processing.
  • Replay: The server executes the request.
  • Response: The server sends back the result.

Q17: What are the things included in a Response?
A17: A typical REST API response includes:

  • Status Code: Indicates success (e.g., 200) or failure (e.g., 404, 500).
  • Headers: Provide metadata about the response.
  • Body: Contains the actual data or result of the request, typically in JSON or XML format.

This format covers essential REST API topics with questions commonly asked during real-time implementations, providing clear and concise answers for each.