Trailing slash in REST API DOES matter

This is like a reminder to myself but assumed others might also be interested in it.

When designing REST API, remember that every character in the URI is important and constitutes unique resource. Hence:

http://your-server.com/api/cars

is different than

http://your-server.com/api/cars/

AWS API Gateway is not different in this case, so pay extra attention as you define e.g. triggers for your lambdas in SAM file:

ReadCars:
    Type: AWS::Serverless::Function
    Properties: (...)
    Events:
        GetEvent:
          Type: Api
          Properties:
            Path: /cars
            Method: get

Mind this /cars value for Path. It means that you can access this resources (here: lambda) only when you’ll enter /cars URL and not /cars/.

It might be REST APIs 101 but still - it might easily be forgotten!