Reference library

API design & gRPC

REST best practices, protobuf, API versioning, and backward-compatible service contracts.

1 match
API design & gRPC medium

How to Build a Hypermedia Collection Resource in Python

Creates a paginated hypermedia collection resource with HATEOAS links and embedded items.

hateoas hal pagination
Python
import json
import math


class HypermediaCollection:
    """A mock hypermedia collection resource."""

    def __init__(self, items, base_url="/api/items"):
        self.items = items
        self.base_url = base_url

    def to_dict(self, page=1, per_page=3):
        total = len(self.items)
        pages = math.ceil…
14 0 Open

Browse by section

Each section groups closely related Python snippets.

API design & gRPC — Python code examples

What you will find here

This page collects api design & grpc snippets — short, copy-ready Python you can paste into our free online IDE and run without installing anything. Each sample includes a plain-English explanation and the full source code.

Samples vs tutorials and challenges

Samples are quick reference — one concept per page. For step-by-step teaching, use our Python tutorials. To test yourself, try quizzes or coding challenges. Clean up style with the Python formatter.