# Developing a public API

- Speaker: [Yonatan Maman](/wiki/speakers/yonatan-maman.md)
- Event: [Reversim Summit 2015](/wiki/years/2015.md)
- Video: https://www.youtube.com/watch?v=LBL1Zlnovk8
- Transcript: [/transcripts/2015/42-LBL1Zlnovk8.md](/transcripts/2015/42-LBL1Zlnovk8.md)
- Language: Hebrew · Type: talk · Level: intermediate
- Topics: [Microservices](/wiki/topics/microservices.md), [Software Engineering](/wiki/topics/software-engineering.md), [Developer Experience](/wiki/topics/developer-experience.md), [Security](/wiki/topics/security.md)

> Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.

## Summary

The speaker shares insights and lessons learned from building and launching a public API over the course of a year. The talk explores treating an API as a product with its own UX, handling documentation effectively, and dealing with challenges like ID obfuscation and versioning. Ultimately, the audience learns practical strategies for designing developer-friendly APIs and avoiding common pitfalls.

## Key points

- [1:17](https://www.youtube.com/watch?v=LBL1Zlnovk8&t=77s) An API is an extension of a product that carries maximum responsibility and minimal control over its usage.
- [3:23](https://www.youtube.com/watch?v=LBL1Zlnovk8&t=203s) Developers are the primary users of the API, and direct feedback from early adopters is invaluable.
- [5:54](https://www.youtube.com/watch?v=LBL1Zlnovk8&t=354s) The UX of an API consists of its resources, URIs, and HTTP methods, requiring consistency and adherence to standards.
- [10:08](https://www.youtube.com/watch?v=LBL1Zlnovk8&t=608s) When designing resource retrieval, deciding whether to embed related objects requires balancing convenience and flexibility.
- [14:32](https://www.youtube.com/watch?v=LBL1Zlnovk8&t=872s) Comprehensive documentation is crucial, and platforms that automatically generate mock servers from documentation help developers work in parallel.
- [22:52](https://www.youtube.com/watch?v=LBL1Zlnovk8&t=1372s) Exposing sequential database IDs in an API creates security and privacy risks that can be mitigated by mapping them to external IDs.
- [26:08](https://www.youtube.com/watch?v=LBL1Zlnovk8&t=1568s) Versioning strategies require careful consideration, whether by maintaining strict backward compatibility or embedding versions in the URL.
- [28:16](https://www.youtube.com/watch?v=LBL1Zlnovk8&t=1696s) Using separate data transfer objects (DTOs) for different API operations and internal logic prevents tight coupling.

## Takeaways

- Treat your API as a first-class product with a strong focus on developer experience and consistent error handling.
- Invest in great documentation and leverage tools that provide mock servers so clients can build against your API before it is fully implemented.
- Avoid exposing raw database primary keys in your endpoints to protect user privacy and improve security.
- Use distinct data models for internal services and public API contracts to maintain flexibility.

## Questions this talk answers

- How should you handle API versioning and backward compatibility?
- What are the best practices for designing clear and useful API documentation?
- How can you prevent exposing internal database IDs through public endpoints?

## Technologies

REST, JSON, XML, Java, JavaScript, Ruby, Python, Scala, Spring MVC

## Tags

api design, developer experience, documentation, public api, security, versioning
