Re: Foreign Exchange Rate API - Can not deserialize instance of java.lang.String out of START_OBJECT

Solved! Go to solution
jody
Regular Visitor

Foreign Exchange Rate API - Can not deserialize instance of java.lang.String out of START_OBJECT...

With the example code, I'm getting the following error...any idea how to fix this?

Tests in error:
postforeignexchangelookupTest(com.visa.developer.sample.foreign_exchange_rates_api.api.FxApiTest): Can not deserialize instance of java.lang.String out of START_OBJECT token(..)

 

2 REPLIES 2
jody
Regular Visitor

Re: Foreign Exchange Rate API - Can not deserialize instance of java.lang.String out of START_OBJECT

Correct, that is the issue.  This is the starter code.  Nothing was changed.  Just trying to get the starter code to work.

API_Products
Visa Developer Support Specialist

Re: Foreign Exchange Rate API - Can not deserialize instance of java.lang.String out of START_OBJECT

Hey @jody,

 

Are you using the FX Rates sample code? Here's the information that we currently have for Java sample code for the Foreign Exchange Rates API. Please see the .zip file attachment.
 
You can run the test to verify your Visa Developer Portal app credentials allow connectivity to the FX API via running the following class using junit, after decompressing the zip and editing the file with your Visa Developer Portal app credentials.
 
File:
foreign_exchange_rates_api/src/test/java/com/visa/developer/sample/foreign_exchange_rates_api/api/FxApiTest.java

Edits to lines 57 – 66 would be enough to properly query the foreign exchange rate api:
// Configure HTTP basic authorization: basicAuth
apiClient.setUsername("YOUR USERNAME");
apiClient.setPassword("YOUR PASSWORD");
apiClient.setKeystorePath("YOUR KEYSTORE PATH");
apiClient.setKeystorePassword("YOUR KEYSTORE PASSWORD");
apiClient.setPrivateKeyPassword("YOUR PRIVATEKEY PASSWORD");

// To set proxy uncomment the below lines
// apiClient.setProxyHostName("proxy.address@example.com");
// apiClient.setProxyPortNumber(0000);

 

You only need to uncomment and edit the proxy lines if your current connection requires a proxy to send external queries.

 

Once your app credentials have been updated, you can use maven “build project” or “mvn clean install” to import the required maven dependencies into your development environment and run the FxApiTest.java file as a junit test. You will be able to see a proper query response, assuming your credentials allow for proper connectivity.




Thanks,

Tee



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.