0

I was wondering if they are any possibility with the sap cloud SDK for java to consume some API used by the cockpit?

For example:

  • To get all services they are the URL below
    https://account.hana.ondemand.com/ajax/getServices/<subaccount>?globalAccountId=<globalaccountid>
    
  • To get all html5 applications they are the URL below:
    https://account.hana.ondemand.com/ajax/getHtml5Applications/<subaccount>
    
  • Last example for destinations:
    https://account.hana.ondemand.com/ajax/destinationsdispatcher/tenant/get/<subaccount>
    

So I would like to consume this service throw my java application, is it possible ? Or does any class/library available in the com.sap.cloud SDK that do the jobs?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • Can you explain what you mean by API used by cockpit, is it some kind of a REST API available in API Business Hub: https://api.sap.com/ ? – Ksivakumar Oct 27 '21 at 07:37
  • If you had a look in the cockpit they are some ajax call like /ajax/getHtml5Applications/ that return a JSON so has this call is not available under any API Business Hub I would like to find a way to consume this API from my java application – Jonathan COLLIN Oct 27 '21 at 10:04
  • If we manage to find the API spec associated with these REST calls, we can use the OpenAPI generator of the SAP Cloud SDK to generate a client to conveniently consume this API: https://sap.github.io/cloud-sdk/docs/java/features/rest/generate-rest-client Let me try to find the associated specification. – Ksivakumar Oct 27 '21 at 11:05
  • Agree with you but this need to use the API Management and configure it also so even I do that I'm not sure I will be able to get all I need – Jonathan COLLIN Oct 27 '21 at 13:52
  • ​Hello, Find something interesting looking this: https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/d31bdd53b57744fcb9eb9c93556cfddf.html We can access Destination in the SAP BTP throw JNDI lookup does any other JNDI available ? – Jonathan COLLIN Oct 28 '21 at 09:00

1 Answers1

0

To access the apps & services in a Cloud Foundry account via REST please refer to the API documentation of Cloud Foundry.

You can also do the same via the Cloud Foundry CLI.

The Destinations you mention are special in the sense that they are not coming from Cloud Foundry directly but belong to a separate, dedicated BTP service which is called Destination Service.

To access Destinations from the BTP Destination Service you can use the SAP Cloud SDK for Java or JavaScript.

MatKuhr
  • 505
  • 4
  • 13
  • Thanks for the reply, but actually what I have done is to declare a new destination to the cockpit URL: https://cockpit.eu10.hana.ondemand.com Basic Authentication provided access Internet From a web application I have put in the neo-app.json file the destination previously created and made the call excalty with /ajax/ but I'm getting an error type 403 Unauthorized to access this page you can check for example if you have a SAP BTP Neo account with the url below https://cockpit.eu10.hana.ondemand.com/ajax/getAllGlobalAccounts – Jonathan COLLIN Oct 27 '21 at 12:43
  • Oh okay you are running on NEO and not on Cloud Foundry. In that case I'd recommend to check [this resource](https://help.sap.com/viewer/b865ed651e414196b39f8922db2122c7/Cloud/en-US/30a5e88495b349e4b073313897342189.html) and this [API documentation](https://api.sap.com/api/SAP_CP_Neo_Connectivity_Destination/resource). – MatKuhr Oct 28 '21 at 07:16
  • 1
    I'd recommend migrating to CF from Neo soon. You'll have a much richer and better-supported ecosystem. – Artyom Kovalyov Oct 28 '21 at 17:02