Skip to main content

🔗 Endpoints and Resources

APIs expose their power through endpoints

. Think of each endpoint as a door into a service. What lies behind that door is the resource, and the method you use to open it defines what you’re allowed to do.

If you’ve already explored Authentication and Authorization, you’ve seen how endpoints are protected through mechanisms like tokens and scopes. But now it’s time to focus on the structure of those endpoints—how you name them, organize them, and make them intuitive to use.

REST APIs reward consistency. A well-designed API reduces onboarding time, eliminates guesswork, and builds trust with frontend teams, integrators, and third-party developers. If you’ve ever wrestled with endpoints like /getUserInfo2, you’ll appreciate the elegance of /users/{id}. Clean endpoints aren't just about aesthetics; they’re foundational to automation, client SDK generation, security, and discoverability.

Let’s walk through common endpoint patterns that demonstrate how simple naming principles make an API feel scalable, trustworthy, and professional.


📬 Common Endpoint Patterns

GET /users

Returns a list of all users in the system.

[ { "id": "123", "name": "Alice", "email": "alice@example.com" }, { "id": "456", "name": "Bob", "email": "bob@example.com" } ]

Figure 1. Common RESTful patterns for endpoints using typical methods like GET, POST, and DELETE with human-readable, nested, and consistent paths.

REST APIs gain their power from clarity and convention. These sample structures showcase how predictable naming leads to readable, testable, and scalable endpoints:

  • /users → list or create users
  • /users/{id} → retrieve, update, or delete a single user
  • /users/{id}/roles → sub-resources or nested relationships
  • /login → authentication route
  • /search?q=value → filtered or parameterized queries

Combined with HTTP status codes

, these endpoints form the backbone of consistent client-server interactions. Tools like Swagger and Postman rely on clean, semantic paths to generate usable test cases and mock services.

RESTful APIs work best when they follow a noun-based URL scheme and use the HTTP method to express action. For example, use POST /users to create a new user—not /createNewUser. The method already tells the story; your URL should represent the resource, not the operation.

Which of the following is NOT a RESTful best practice?

That leads us to a natural follow-up question: how do we organize dozens—or even hundreds—of endpoints so that they scale across teams and services?


🗂️ Resource Grouping and Naming

GET/users

List users

GET/users/:id

Get user by ID

POST/users

Create user

PUT/users/:id

Update user

DELETE/users/:id

Delete user

Figure 2. Grouped resource categories using ResourceGrid to show how logical grouping improves clarity, security, and developer productivity.

As your API grows, organization becomes essential. Flat lists of ungrouped endpoints lead to confusion and slower onboarding. Grouping routes by function—like Authentication, Payments, and Content—provides clarity and helps developers understand your architecture at a glance.

Here are examples of typical API groups:

  • Authentication/login, /logout, /refresh-token
  • User Management/users, /users/{id}, /users/{id}/roles
  • Payments/invoices, /subscriptions, /refunds
  • Content/documents, /uploads, /media

These groupings aren’t just for human readability—they improve tool integration. In Swagger UI

and Redoc, grouped routes appear as collapsible sections, making large APIs easier to navigate and test.

Grouping also enables shared security logic. You can enforce RBAC

rules on /admin/*, or require tokens for /user/*.

Follow these naming rules to keep your API predictable:

  • Use plural nouns (/projects, not /project)
  • Stick to lowercase only
  • Avoid dashes or underscores in paths
  • Never include verbs in URLs—the method handles that

Consistency is more than aesthetic; it improves tooling, reduces bugs, and removes guesswork.


🧪 Try the Endpoints Live

💡 Note: Make sure your local server (e.g., Mockoon) is running at http://localhost:3000 for the Try It Out feature to work properly.

Figure 3. Embedded Swagger UI loaded from a local OpenAPI file. You can explore routes and test them in-browser using the Try It Out button, even without a live backend.

This embedded Swagger UI demonstrates how endpoints look in practice. Even if the backend isn’t running, you can simulate requests, explore parameter inputs, and see response schemas—all through a local OpenAPI spec.

If you want live behavior, tools like Mockoon let you host mock responses from a static YAML spec. Just point Swagger at http://localhost:3000, and you’ll see working requests even before your real server is online.


    ✅ Summary and What’s Next

    You’ve now learned how to name, group, and structure endpoints using RESTful best practices. Clean naming and thoughtful grouping reduce ambiguity, improve testability, and support better documentation across your entire platform.

    Endpoints define what a user can request. But that leaves one big question: who is allowed to make those requests, and how do we enforce it?

    In the next section, we’ll dive into API tokens

    , including how to scope, validate, and issue tokens that protect your API at every layer.

    👉 Continue to API Token.