A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.amplify.aws/gen1/swift/build-a-backend/restapi/fetch-data/ below:

Website Navigation


Fetch data - Swift - AWS Amplify Gen 1 Documentation

Fetch data GET requests

To make a GET request, first create a RESTRequest object and then use the Amplify.API.get api to issue the request:

Handling non-2xx HTTP responses

When your service returns a non-2xx HTTP status code in the response, the API call will result in a failure that you can handle in your app. The response body can be accessed from the body: Data? property. For example, when the APIError is an .httpStatusError(StatusCode, HTTPURLResponse), then access the response body by type casting the response to an AWSHTTPURLResponse and retrieve the body field.

Accessing query parameters & body in Lambda proxy function

To learn more about Lambda Proxy Integration, please visit Amazon API Gateway Developer Guide.

If you are using a REST API which is generated with Amplify CLI, your backend is created with Lambda Proxy Integration, and you can access your query parameters & body within your Lambda function via the event object:

Alternatively, you can update your backend file which is located at amplify/backend/function/[your-lambda-function]/app.js with the middleware:

Accessing query parameters with Serverless Express

In your request handler use req.apiGateway.event or req.query:

Then you can use query parameters in your path as follows:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4