You can tell an engineering team’s maturity by how many ways they’ve tried to automate code review. Gerrit is often the backbone of that process, but its integration story can feel like it’s still living in 2011. Enter Gerrit JSON-RPC, the old yet surprisingly useful interface that lets external tools talk to Gerrit through lean, structured calls instead of brittle web scraping or plugin glue.
Gerrit JSON-RPC gives you a programmable handle on user sessions, patch sets, and review actions. Instead of clicking through the web UI, you can approve, query, or recheck changes from your automation pipelines. It’s a quiet bridge between human review and system workflows, and when wired right, it becomes the muscle behind continuous delivery approvals and compliance-grade audit logs.
Unlike HTTP REST APIs, JSON-RPC in Gerrit is purely procedural. You call methods, Gerrit executes them, and you get exactly one response. No nested resources or pagination puzzles. This simplicity makes it perfect for internal automation where predictability beats flexibility. A typical setup allows Jenkins, GitLab runners, or internal bots to submit review actions just like real users, mapped through identity and permission layers.
The workflow starts with authentication. Gerrit checks the caller’s session or cookie, validates it against its account database, and executes the requested method. Add a service account with scoped permissions instead of reusing admin credentials, and your automation gains least-privilege access. The data path stays concise: one JSON object in, one JSON object out. That clarity is part of its charm.
Best practices when using Gerrit JSON-RPC
Reserve JSON-RPC for controlled internal traffic, ideally behind TLS with restricted origin. Rotate service tokens frequently and log invocation metadata for audits. If you’re integrating with Okta or AWS IAM, wrap your RPC calls with short-lived tokens derived from those sessions. It keeps reviews fast and compliant with SOC 2 and ISO 27001 demands.