Ben Jonson
Ben Jonson

Reputation: 739

Defining API path with query string Serverless HTTP API (API Gateway v2)

How can I define the path in serverless.yml with more than one query parameter using HTTP API (API Gateway v2) so that the endpoint looks like the following:

https://example.com/rest/endpoint?id=$id&tag=$tag

serverless.yml

 dfsPostback: 
    handler:  handlers/result.main 
    events:
      - httpApi:
          path: /dfs-pingback  // need help here 
          method: get

I tried with

path: /dfs-pingback?id={id}&tag={tag}

deployment failed

Upvotes: 2

Views: 1107

Answers (1)

pgrzesik
pgrzesik

Reputation: 2427

There is no need to specify the query parameters in the path. You should be able to access all passed query params in your event handler.

Upvotes: 3

Related Questions