Path Parameters

Understand how path parameters are mapped in the API gateway.

What's a path parameter?

Consider the URL https://example.com/val1/val2. Here, val1 and val2 are parts of the URL path. We can configure the API Gateway to treat these values as parameters. It can use these values for routing or just any computation. Similar to query parameters, we need query parameter integration in two scenarios.

  • The URL invoking our API contains path parameters that should pass into the target API.

  • The URL of the target API requires some path parameters that come from the input URL.

API Gateway enables either of them. When we integrate the requests, we can use the path parameters to get the required mapping.

Example mapping

Let’s check out an example where we map the path parameters to the URL of the target API. The https://ipinfo.io API is free and provides information about an IP address. Let’s integrate it into our API Gateway to demonstrate the path parameters.

Get hands-on with 1400+ tech skills courses.