4

I have the following endpoint that a client sent me:

https://{restapi_id}.execute-api.{region}.amazonaws.com/test/v1/items?type=ABC

Since this request needs to be called with the AWS Authorization process I wanted to use the API Gateway SDK, but I can't find a straightforward example on how to call it. I was able to successfully test the API call using Postman (as exaplained in the AWS docs), but I don't know how to specify it using the SDK. The ENDPOINT should be the full URL? How should I make a call beyond this code? I tried using the GetResourceRequest, but that doesn't seem right. If so, what part of this URL I have is the resource?

This is code where I'm stuck with:

BasicAWSCredentials awsCreds = new BasicAWSCredentials(ACCESS_KEY, SECRET_KEY);

AmazonApiGatewayClient api = new AmazonApiGatewayClient(awsCreds);
api.setRegion(Region.getRegion(Regions.US_EAST_1));
api.setServiceNameIntern("execute-api");
api.setEndpoint(ENDPOINT);

2 Answers 2

2

Here's an open-source generic SDK you can use to do this: https://github.com/rpgreen/apigateway-generic-java-sdk

You can also generate your own SDK as per https://aws.amazon.com/blogs/developer/api-gateway-java-sdk/

Sign up to request clarification or add additional context in comments.

Comments

1

AmazonApiGatewayClient is for managing the apis, you cannot use it to call your api.

We just launched support to generate a Java SDK for an apis, you can use that to call your api (link to docs). Note that you need to generate the SDK from the export tab in the stage.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.