Closed FA5I closed 2 years ago
Hi @acse-fk4517,
Did you use Mustache templates while generating the Java client library? The Mustache templates that comes with Java AA library might not work with Open API generator.
Thanks, Parvathm, Selling Partner API Developer Support.
Hi @parvathm ,
Yes I generate the SDK with the following flag:
--template-dir clients/sellingpartner-api-aa-java/resources/swagger-codegen/templates
Does that mean I need to generate generate a separate Moustache template to get this to work?
The authentication Java AA works with no errors. I assumed this would mean it is working correctly with the Open API generator. To get the AA working I just followed the steps in the docs. However when I try and call the Seller API, the classes are not being picked up.
@FA5I, did you try installing the generated SDK as mentioned in the ReadMe.md file?
Mentioning below the Installation steps found in ReadMe.md present in the generated SDK:
To install the API client library to your local Maven repository, simply execute:
mvn clean install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn clean deploy
Refer to the OSSRH Guide for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-java-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
Add this dependency to your project's build file:
compile "io.swagger:swagger-java-client:1.0.0"
At first generate the JAR by executing:
mvn clean package
Then manually install the following JARs:
target/swagger-java-client-1.0.0.jar
target/lib/*.jar
Thanks @AshokRaja10 , I will take a look at this and implement the steps you have outlined!
Hi!
I generated the Java SDK according to the doc (Generating a Java SDK with LWA token exchange and authentication). But my code doesn't compile when I try to implement a SellersApi, (Create an instance of the Sellers API and call an operation). The builder from SellersApi is not recognized. Here is my code:
AWSAuthenticationCredentials awsAuthenticationCredentials = AWSAuthenticationCredentials.builder()
.accessKeyId("myAccessKeyId")
.secretKey("mySecretId")
.region("us-east-1")
.build();
AWSAuthenticationCredentialsProvider awsAuthenticationCredentialsProvider = AWSAuthenticationCredentialsProvider.builder()
.roleArn("myroleARN")
.roleSessionName("myrolesessioname")
.build();
LWAAuthorizationCredentials lwaAuthorizationCredentials = LWAAuthorizationCredentials.builder()
.clientId("myClientId")
.clientSecret("myClientSecret")
.refreshToken("Aztr|...")
.endpoint("https://api.amazon.com/auth/o2/token")
.build();
SellersApi sellersApi = new SellersApi.Builder()
.awsAuthenticationCredentials(awsAuthenticationCredentials)
.lwaAuthorizationCredentials(lwaAuthorizationCredentials)
.awsAuthenticationCredentialsProvider(awsAuthenticationCredentialsProvider)
.endpoint("https://sellingpartnerapi-na.amazon.com")
.build();
What could I have missed? Thanks for your help!
The new API has no builder method, no awsauthenticationcredentials, lwaauthorizationcredentials, endpoint, lwaaccesstokencache, and so on
Same problem to me. It's not clear
This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.
Same issue here (The SellerApi class isn't imported), anyone figured out a possible solution? I'm using a gradle project not maven so maybe I have missed out the installation part as its specified for maven only. Can anyone please specify how to install the library for a gradle repository.
I am playing around with the java library (I know how the auth flow works etc and have made a minimal python SDK that can make calls). However, I want to get familiar with the Amazon Java Client SDK, and I just cannot seem to figure out based on the documentation what to do next.
Within the model folder I have all of the models:
My Kotlin code (which is completely interoperable with Java) looks as follows:
As you can see below, in line 29 there is an unresolved reference (the APIAA stuff works fine). I do not understand why this is the case, since I have built the Jar as per the documentation, and also added it to my maven project as a dependency:
Error:
Can someone please help me out in trying to understand this? I would rather just use the Java SDK if it has all the endpoint calls and functions defined as per the open API schema.