🌍 Back-end Web Developement · subject
Back-end Web Developement APIs Syllabus
The APIs syllabus for Back-end Web Developement in full: 3 chapters and 8 topics, every one listed below, plus 51 APIs flashcards with answers.
APIs syllabus: all 3 chapters
Expand any chapter to see its topics and sub-topics.
-
REST
3 topics- Principles
- Best Practices
- Authentication & Authorization
-
GraphQL
3 topics- Schema Definition
- Resolvers
- Queries and Mutations
-
WebSockets
2 topics- Real-time Communication
- Socket.IO
Back-end Web Developement APIs flashcards — 51 questions with answers
What does API stand for, and what is its core purpose?
Application Programming Interface. It is a defined contract that lets two software systems communicate, exposing a set of operations a client can invoke while hiding the provider's internal implementation.
State the REST architectural principle of statelessness.
Each request from client to server must contain all information needed to understand and process it; the server stores no client session state between requests, so any server can handle any request.
List the core constraints of the REST architectural style.
Client-server separation, statelessness, cacheability, uniform interface, layered system, and (optionally) code-on-demand.
What is the 'uniform interface' constraint in REST, and its four sub-principles?
A consistent way of interacting with resources. Its sub-principles are: resource identification via URIs, manipulation of resources through representations, self-descriptive messages, and HATEOAS (hypermedia as the engine of application state).
In REST, what is a 'resource' versus a 'representation'?
A resource is any named information/entity the API exposes (e.g., a user). A representation is a concrete serialized form of that resource's state at a point in time (e.g., JSON or XML), transferred between client and server.
Match the primary HTTP methods to their CRUD operations.
POST = Create, GET = Read, PUT/PATCH = Update, DELETE = Delete.
What is the difference between PUT and PATCH?
PUT replaces the entire resource with the provided representation (idempotent full update). PATCH applies a partial modification, updating only the specified fields.
Define idempotency for an HTTP method and list which standard methods are idempotent.
An operation is idempotent if making the same request multiple times yields the same server state as making it once. GET, PUT, DELETE, HEAD, and OPTIONS are idempotent; POST and PATCH generally are not.
Which HTTP methods are considered 'safe', and what does safe mean?
GET, HEAD, and OPTIONS are safe. Safe means the method is read-only and does not alter server state.
What do the HTTP status code classes 2xx, 3xx, 4xx, and 5xx signify?
2xx = Success, 3xx = Redirection, 4xx = Client error, 5xx = Server error.
Give the meaning of status codes 200, 201, 204, 400, 401, 403, 404, and 500.
200 OK, 201 Created, 204 No Content, 400 Bad Request, 401 Unauthorized (not authenticated), 403 Forbidden (authenticated but not permitted), 404 Not Found, 500 Internal Server Error.
What is the difference between HTTP 401 and 403?
401 Unauthorized means the request lacks valid authentication credentials (who are you?). 403 Forbidden means the client is authenticated but lacks permission for the resource (you can't do this).
What is a REST best practice for naming resource endpoints?
Use plural nouns (not verbs) for collections, e.g. GET /users and GET /users/{id}; express hierarchy through nested paths like /users/{id}/orders, and let the HTTP method convey the action.
Why and how should a REST API implement versioning?
To evolve the API without breaking existing clients. Common strategies: URI versioning (/v1/users), custom header, or media-type/content negotiation (Accept: application/vnd.api.v1+json).
What is pagination in an API, and name two common strategies.
Splitting large result sets into smaller pages to limit payload size. Strategies: offset/limit (or page/size) pagination, and cursor-based (keyset) pagination using an opaque pointer to the last item.
What is rate limiting and why is it a best practice?
Restricting how many requests a client may make in a time window to protect the server from abuse/overload and ensure fair usage. Often signaled via headers like X-RateLimit-Remaining and status 429 Too Many Requests.
What is CORS and what problem does it solve?
Cross-Origin Resource Sharing: an HTTP-header-based mechanism letting a server declare which origins (other than its own) may access its resources, relaxing the browser's same-origin policy in a controlled way.
Distinguish authentication from authorization.
Authentication verifies identity (who you are). Authorization determines what an authenticated identity is permitted to do (which resources/actions are allowed).
What are the three parts of a JWT (JSON Web Token), separated by dots?
Header, Payload, and Signature — each Base64URL-encoded and joined as header.payload.signature.
How does a JWT's signature guarantee integrity?
The signature is computed over the encoded header and payload with a secret or private key (e.g., HMAC-SHA256 or RSA). Any tampering with header/payload invalidates the signature when the server re-verifies it, so altered tokens are rejected.
Show the other 31 APIs flashcards
Contrast stateful (session-based) authentication with stateless (token-based) authentication.
Session-based: server stores session state and gives the client a session ID (usually in a cookie); server must look it up each request. Token-based (e.g., JWT): the token itself carries the claims and is verified by signature, so the server keeps no per-session state.
In the OAuth 2.0 framework, name the four main roles.
Resource Owner (the user), Client (the app requesting access), Authorization Server (issues tokens), and Resource Server (hosts the protected resources).
What is the difference between OAuth 2.0 and OpenID Connect (OIDC)?
OAuth 2.0 is an authorization framework (delegating access via access tokens). OIDC is an authentication layer built on top of OAuth 2.0 that adds an ID token to verify user identity.
How is a Bearer token sent in an HTTP request?
In the Authorization header: Authorization: Bearer <token>.
Compare RBAC and ABAC authorization models.
RBAC (Role-Based Access Control) grants permissions based on a user's assigned roles. ABAC (Attribute-Based Access Control) grants access by evaluating policies over attributes of the user, resource, action, and environment/context.
Why should passwords be stored hashed with a salt rather than encrypted or in plaintext?
Hashing is one-way, so the original password cannot be recovered if the store leaks. A unique salt per password prevents identical passwords from sharing a hash and defeats precomputed rainbow-table attacks. Use slow adaptive functions like bcrypt, scrypt, or Argon2.
What is the primary difference between an API key and a JWT for authentication?
An API key is a static opaque identifier (typically identifying an application/project, requiring a server lookup) whereas a JWT is a signed, self-contained token carrying claims about the user that can be validated without a database lookup and can expire.
In GraphQL, what is a schema and what language defines it?
The schema is the contract describing all types, fields, and operations the API exposes. It is written in SDL (Schema Definition Language) and is strongly typed.
Name the three special/root operation types in a GraphQL schema.
Query (read), Mutation (write/modify), and Subscription (real-time streamed updates).
In GraphQL SDL, what does the '!' symbol mean on a field type?
It marks the field as non-nullable (required). For example, name: String! must always return a value, and [String!]! is a non-null list of non-null strings.
List the built-in scalar types in GraphQL.
Int, Float, String, Boolean, and ID.
What is the difference between a GraphQL 'type' (object type) and an 'input' type?
An object type describes data returned by the server and can be used in query responses. An input type is used only to pass structured arguments into fields/mutations and cannot contain fields that return object types with resolvers.
What is an enum type in a GraphQL schema?
A scalar restricted to a fixed set of allowed named values, e.g. enum Role { ADMIN USER GUEST }, which the server validates against.
In GraphQL, what is an interface type used for?
An interface is an abstract type defining a set of fields that multiple object types must implement, enabling polymorphic fields that can return any implementing type.
What is a resolver in GraphQL?
A function that produces the value for a single field in a schema. When a query executes, GraphQL calls the resolver for each requested field to fetch or compute its data.
What are the four standard arguments passed to a GraphQL resolver function?
parent (the result of the parent/previous resolver), args (the field's arguments), context (shared per-request data like auth/db), and info (AST/metadata about the execution state).
What is the 'context' argument in a resolver typically used for?
To share per-request state across all resolvers, such as the authenticated user, database connections, data loaders, and request headers.
What is the N+1 problem in GraphQL resolvers, and a common solution?
When resolving a list of N items, a naive per-item resolver triggers 1 query for the list plus N additional queries for related data. It is solved by batching and caching requests, e.g. using DataLoader to coalesce them into a single query.
What happens if you do not define a resolver for a field in GraphQL?
GraphQL uses a default resolver: it returns the property of the parent object with the same name as the field (or calls it if it is a function), returning null if absent.
What is the key difference between a GraphQL query and a mutation?
A query fetches (reads) data and top-level query fields run in parallel. A mutation modifies (writes) data and top-level mutation fields execute serially, one after another, to avoid race conditions.
How are variables passed to a GraphQL query instead of hardcoding arguments?
By declaring them in the operation signature with a $ prefix and type, e.g. query GetUser($id: ID!) { user(id: $id) { name } }, then supplying a separate JSON variables object with the values.
What is a fragment in GraphQL?
A reusable named set of fields on a type that can be spread into multiple queries/mutations to avoid repetition, e.g. fragment UserFields on User { id name email }.
What is an alias in a GraphQL query and why is it needed?
An alias renames a field's result key, letting you request the same field multiple times with different arguments in one query, e.g. hero: character(id:1) { name } villain: character(id:2) { name }.
State one major advantage GraphQL offers over REST regarding data fetching.
Clients request exactly the fields they need in a single request, eliminating over-fetching and under-fetching (and the multiple round-trips REST often requires).
What is the fundamental limitation of plain HTTP request/response for real-time communication?
HTTP is client-initiated and half-duplex per exchange: the server cannot push data to the client on its own; the client must poll or re-request, causing latency and overhead.
Compare short polling, long polling, SSE, and WebSockets for real-time updates.
Short polling: client repeatedly requests at intervals (high overhead). Long polling: server holds the request open until data is ready. SSE (Server-Sent Events): one-way server-to-client stream over HTTP. WebSockets: full-duplex, persistent, bidirectional connection.
What is the WebSocket protocol and how does a connection start?
A protocol providing a persistent, full-duplex TCP channel between client and server. It begins with an HTTP Upgrade handshake (Connection: Upgrade, Upgrade: websocket); once accepted, communication switches to the ws:// or wss:// protocol.
What is Socket.IO and how does it relate to WebSockets?
Socket.IO is a library for real-time bidirectional event-based communication. It uses WebSockets when available but adds features like automatic reconnection, fallbacks (e.g., HTTP long-polling), rooms, namespaces, and acknowledgements — so it is not a pure WebSocket implementation.
In Socket.IO, what are the emit and on methods used for?
socket.emit(event, data) sends/publishes a named custom event with a payload to the other side; socket.on(event, callback) registers a listener that handles incoming events of that name.
In Socket.IO, what is a 'room' and how is it used?
A room is a server-side channel that sockets can join or leave (socket.join('roomName')); the server can then broadcast to all sockets in that room with io.to('roomName').emit(...), enabling targeted group messaging like chat channels.
In Socket.IO, distinguish socket.emit, socket.broadcast.emit, and io.emit.
socket.emit sends only to that one connected client; socket.broadcast.emit sends to all connected clients except the sender; io.emit sends to every connected client including the sender.
Back-end Web Developement APIs FAQ
What is in the Back-end Web Developement APIs syllabus?
Back-end Web Developement APIs is split into 3 chapters: REST, GraphQL and WebSockets. Together they contain 8 topics.
How many chapters are in Back-end Web Developement APIs?
3 chapters, containing 8 topics. The largest chapter is REST, with 3 topics.
Are there flashcards for Back-end Web Developement APIs?
Yes — a 51-card APIs deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.