Thomas
Thomas

Reputation: 1100

How To pass body on AWS API-Gateway generated SDK on Android

I have created an API-GATEWAY to storefiles on spezific S3 buckets. Its a simplified version of http://docs.aws.amazon.com/apigateway/latest/developerguide/integrating-api-with-aws-services-s3.html

We want to write only to a spezific S3 bucket.

Methode Request

When I test it on the API-GATEWAY Console, it works fine i can fill out the item parameter and the body and an new file is created on the S3.

But when I deploy the API and generate the SDK I get following code:

 @com.amazonaws.mobileconnectors.apigateway.annotation.Operation(path = "/upload/{item}", method = "PUT")
void uploadItemPut(
        @com.amazonaws.mobileconnectors.apigateway.annotation.Parameter(name = "item", location = "path")
        String item);

}

The methode uploadItemPut has only one parameter item, so how can I put the body to the request?

Need I some mapping Method Execution->Request Body? But then a need an Model, for byte[]

Upvotes: 0

Views: 552

Answers (1)

jackko
jackko

Reputation: 7344

Unfortunately the Android/iOS/Java SDKs are built for JSON Schema Models, meaning the SDKs only use native POJOs for input/output.

I think for this use case you would be better suited to adapt a more generic HTTP client for Android. If you need AWS Auth, you can just pull the auth code out of the generate API GW SDK and apply that to a generic HTTP client.

Upvotes: 1

Related Questions