Slide 1

Slide 1 text

Real-Life REST API Versioning Hands on! Alexandre TOURET

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

The Bookstore API

Slide 4

Slide 4 text

The context diagram

Slide 5

Slide 5 text

Under the hood

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Let's version this API

Slide 8

Slide 8 text

Alexandre TOURET Software Architect, Developer Advocate @touret_alex blog.touret.info alexandre-touret Who am I?

Slide 9

Slide 9 text

We design payments technology that powers the growth of millions of businesses around the world. 7000+ engineers in over 40 countries Managing 43+ billion transactions per year €250M R D every year Handling 150+ payment methods

Slide 10

Slide 10 text

What about API versioning?

Slide 11

Slide 11 text

What is it versioned? We only version API contract breaking changes (operations or data/fields)

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

✓ adding an operation ✓ adding an optional parameter ✓ adding an optional request header ✓ adding a response field ✓ adding a response header ✓ adding enum values ✓ removing an entire operation ✓ removing or renaming a parameter ✓ removing or renaming a response field ✓ adding a new required parameter ✓ making a previously optional parameter required ✓ changing the type of a parameter or response field ✓ removing enum values ✓ adding a new validation rule to an existing parameter ✓ changing authentication or authorization requirements Changes according GitHub https://docs.github.com/en/rest/overview/api-versions?apiVersion=2022-11-28 Breaking Non-breaking

Slide 14

Slide 14 text

https://cloud.google.com/blog/products/api-management/common- misconceptions-about-api-versioning?hl=en https://docs.github.com/en/rest/overview/api-versions?apiVersion=2022- 11-28 Going further

Slide 15

Slide 15 text

Workshop

Slide 16

Slide 16 text

• See what is a non breaking change and the impacts • Setup a URL versioning and a Header versioning and see the impacts • Modify configuration to take versioning into account • Add a breaking change • Strive for backward compatibility between the V1 and the V2 • Enforce versioning authorization with scopes Topics covered

Slide 17

Slide 17 text

The workshop & the solution https://github.com/alexandre-touret/rest-apis-versioning-workshop https://github.com/alexandre-touret/rest-apis-versioning-solution 2H_WORKSHOP branch

Slide 18

Slide 18 text

You will learn in this chapter: • How to start the platform • H ’ API contract Chapter 1 How to upgrade your API without versioning?

Slide 19

Slide 19 text

You will learn in this chapter: • The impacts of the versioning in the OPENAPI Description file • Implement a URL Based versioning • Implement a header-based versioning • Deploy and configure a default version for your API Chapter 2 Your first version

Slide 20

Slide 20 text

You will learn/do in this chapter: • Create a new version (it will be a copy of the rest-book module) • Add a new breaking change functionality to the last version Chapter 3 Your second version

Slide 21

Slide 21 text

You will learn/do in this chapter: • Pinpoint Configuration management issues due to API Versioning • Exposing the two versions on the API Gateway Chapter 4 Configuration management

Slide 22

Slide 22 text

You will learn/do in this chapter: • Dig into Backward compatibility hassle and implement a solution to make both of the two versions work Chapter 5 Dealing with breaking changes

Slide 23

Slide 23 text

You will learn/do in this chapter: • Pinpointing the impacts on authorization • Enforcing API versions restrictions with OAUTHv2 scopes Chapter 6 Security and authorization impacts

Slide 24

Slide 24 text

Code & configuration

Slide 25

Slide 25 text

Main Feature Hotfix Develop Release V1 V2 V2.1 Release with the list of authors Backward compatibility V1.1

Slide 26

Slide 26 text

Configuration management

Slide 27

Slide 27 text

Authorization

Slide 28

Slide 28 text

D ’ ! Follow & get in touch @touret_alex linkedin.com/in/atouret blog.worldline.tech @WorldlineTech Follow our tech team: Follow me: blog.touret.info alexandre-touret Feedback

Slide 29

Slide 29 text

Explore our jobs in tech: careers.worldline.com Want to shape how the world pays and get paid?