A new Oracle enterprise application requires a set of robust and scalable APIs. As a Full Stack Developer, how would you design the API architecture, considering REST principles, data consistency, and versioning for long-term maintainability?

OracleFull Stack Developer3–5 YearsAPI Design

5 min readUpdated

A robust API for an enterprise application, especially at Oracle’s scale, necessitates adherence to REST principles, emphasizing resource-based design, statelessness, and a clear contract. The architecture should prioritize scalability, security, and a positive developer experience. This involves careful resource modeling, consistent endpoint naming, appropriate HTTP method usage, and comprehensive error handling.

Resource Modeling & Operations

Begin by identifying the core business entities as resources (e.g., /customers, /orders, /products). Define clear relationships between them. For each resource, map standard CRUD (Create, Read, Update, Delete) operations to HTTP methods: POST for creation, GET for retrieval, PUT for full updates, PATCH for partial updates, and DELETE for removal. Ensure endpoints are nouns, not verbs.

Best practice

Implement API versioning from the outset (e.g., /v1/customers), preferably via URL paths for clarity, though header-based versioning is also common. Adopt a consistent naming convention for resources and fields (camelCase for JSON, snake_case for query parameters). Use standard HTTP status codes (200 OK, 201 Created, 204 No Content, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 500 Internal Server Error) to convey meaning clearly.

Edge case interviewers probe for

Interviewers often inquire about handling large data sets (pagination, filtering, sorting), batch operations to reduce chattiness, partial updates (PATCH vs PUT), and idempotent operations. Discuss how to design endpoints and payload structures for these scenarios. For instance, pagination involves _page and _limit query parameters, while PATCH requests send only the fields to be updated.

Common mistake

A common pitfall is creating chatty APIs that require multiple requests for a single logical operation, leading to increased latency. Another is failing to implement proper error handling with meaningful error messages and status codes. Ignoring security concerns like authentication, authorization, and input validation from the design phase also leads to vulnerabilities. Not versioning early on creates significant backward compatibility challenges.

What the interviewer is checking

The interviewer is assessing your understanding of fundamental API design principles (REST, HATEOAS), your ability to think about scalability, security, and maintainability, and your practical experience with API lifecycle management. They want to see if you can make thoughtful trade-offs and consider the long-term impact of design decisions on an enterprise application.

Imagine an API is like a well-organized library. When you want a book (data), you don’t just shout into a random room; you go to the librarian (the API). The library has a catalog (the API documentation) that tells you exactly where to find different types of books (resources) and how to ask for them (HTTP methods like GET to borrow, POST to donate a new book).

A good library (API) is designed so anyone can understand its rules. Books are organized by genre or author (consistent naming and resource paths), and the librarian always tells you if a book is available or if you need to come back later (status codes). This clear system makes it easy for anyone to find what they need without confusion, much like a well-designed API makes it easy for different parts of an application to communicate.

Why interviewers ask this

To gauge your understanding of fundamental software architecture, communication protocols, and your ability to design extensible, maintainable systems. It reveals your practical experience in building systems that other developers will consume.

What a strong answer signals

A strong answer demonstrates a solid grasp of REST principles, security considerations, and performance optimization. It shows you can think holistically about an API’s lifecycle, from initial design to versioning and deprecation, and consider the perspective of both the backend and frontend developers.

Common follow-ups

  • How would you secure this API against common vulnerabilities?
  • What strategies would you use for API rate limiting and why?
  • How would you handle complex queries or filtering for large datasets?

Advanced variation

Compare and contrast designing this API using REST versus GraphQL. When would you choose one over the other for a new service at Oracle, and what are the trade-offs in terms of development velocity, performance, and maintainability?

An initial version of an Oracle internal project management application’s API had endpoints like /getProjects, /createTask, and /updateProjectStatus. This verb-based, inconsistent design made it hard for new frontend developers to quickly understand and use, leading to errors and increased development time. The API was redesigned using REST principles. Endpoints became resource-centric, such as /v1/projects (GET for all, POST for new), /v1/projects/{id} (GET, PUT, PATCH, DELETE), and /v1/projects/{id}/tasks (nested resource for tasks within a project). This shift, coupled with clear documentation and consistent HTTP status codes, significantly improved developer experience, reduced integration time, and made the API more extensible.

products.js
const express = require('express');
const router = express.Router();
// Assume db connection and validation middleware are imported

router.get('/', async (req, res) => {
  // Fetch paginated products, e.g., /products?page=1&limit=10
  const { page = 1, limit = 10 } = req.query;
  try {
    const products = await ProductService.getProducts(parseInt(page), parseInt(limit));
    res.status(200).json(products);
  } catch (error) {
    res.status(500).json({ message: 'Error fetching products', error: error.message });
  }
});

router.post('/', async (req, res) => {
  // Create a new product
  const newProduct = req.body;
  try {
    const created = await ProductService.createProduct(newProduct);
    res.status(201).json(created); // 201 Created for successful resource creation
  } catch (error) {
    res.status(400).json({ message: 'Invalid product data', error: error.message });
  }
});

router.get('/:id', async (req, res) => {
  // Retrieve a specific product by ID
  try {
    const product = await ProductService.getProductById(req.params.id);
    if (!product) {
      return res.status(404).json({ message: 'Product not found' });
    }
    res.status(200).json(product);
  } catch (error) {
    res.status(500).json({ message: 'Error fetching product', error: error.message });
  }
});

module.exports = router;
Client API Gateway (Auth, Rate Limit) /v1/products Product Service Database
  1. 1Prioritize REST principles for resource-centric and stateless API design.
  2. 2Implement versioning and consistent naming conventions from the start for maintainability.
  3. 3Utilize standard HTTP methods and status codes to convey clear meaning and facilitate error handling.
  4. 4Consider scalability challenges like pagination, filtering, and rate limiting in the initial design.
  5. 5Embed security (authentication, authorization, validation) as a core aspect, not an afterthought.