Skip to Main Content

Developer Community

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Get String response from Oracle fusion cloud rest api

David AyalaFeb 10 2024

I am trying to get the response ins tring format for a rest api from Oracle Fusion Cloud ERP, with a development in java spring boot with the resttemplate library, but it seems we are not receinving the correct response despite the status is ok.

I am included the code I use to just get the information of a receivables transaction, but I have tried also to use a patch rest api and the transaction is updated but I still receive the same type of response.

RestTemplate restTemplate =new RestTemplate(new HttpComponentsClientHttpRequestFactory());

HttpHeaders headers = new HttpHeaders();

JSONObject responseBody = new JSONObject();

String username = ""; //Not included for security reasons

String password = ""; //Not included for security reasons

headers.setBasicAuth(username, password);

headers.add("Content-Type", "application/json");

String uri = "https://ENVIRONMENT_CODE.fa.em2.oraclecloud.com/fscmRestApi/resources/latest/receivablesInvoices/1479087";

HttpEntity<String> request = new HttpEntity<String>(headers);

System.out.println(request.toString());

System.out.println("------------------------------------");

ResponseEntity<String>resp = restTemplate.exchange(uri, HttpMethod.GET, request, String.class);

System.out.println(resp.getStatusCode().toString());

System.out.println("------------------------------------");

System.out.println(resp.toString());

System.out.println("------------------------------------");

responseBody = new JSONObject(resp.getBody());

System.out.println(responseBody);

But in the response it seems we get specials characters and I do not know in which format could it be.

I am attaching the following document with a screenshot of the results of the console.

SR Details.docx

Comments
Post Details
Added on Feb 10 2024
0 comments
381 views