cancel
Showing results for 
Search instead for 
Did you mean: 

External service from WebIDE

gopi_nidjelli2
Participant
0 Kudos

Hi All,

     I am trying to access a 3rd party external json/webservice to update the data. What should be my approach?

1. Can we create a new destination for the external service in HANA Cockpit as we register the SAP Odata service?

2. Can I call the external service directly from the code to update the data?

3. Can I call this external service from SAP Odata service and use this in the webIDE ?

Appreciate your expert advise.

Thanks, Gopi

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

1) yes, just put type HTTP for destination.

2) yes. add a mapping in neo-app.json

{

  "path": "/your_service",

  "target": {

   "type": "destination",

   "name": "YOUR_DESTINATION",

   "entryPath": "/whatever_is_the_entrypath"
  },

  "description": "Your destination"
},

and use that mapping prefix to call an external service

3) yes, see abow. oDataModel( "/your_service/odata_service_name" )

nidjelligopi
Explorer
0 Kudos

Thanks Maksim,

           I have created the destination for the json service as below. When I create a project from template in webIDE I don't see this destination, where as i see other destinations like northwind.

Am I missing anything?

Also is it a good approach to call this json service and create a odata service and the use that in the webIDE?

Please suggest.

Thanks

Gopi

former_member182372
Active Contributor
0 Kudos

in order to see destination in web ide you need to set properties of destination

sap-client = <client>

WebIDEEnabled = true

WebIDESystem = SID_OF_THE_SYSTEM

WebIDEUsage = odata_abap,dev_abap,data_abap,ui5_execute_abap

former_member182372
Active Contributor
0 Kudos

didn't really get second question -

>>Also is it a good approach to call this json service and create a odata service and the use that in the webIDE?


json service != odata service


destinations are more HCP thing rather then Web ide

nidjelligopi
Explorer
0 Kudos

Hi Maksim,

       In my case the api is public api. The url is http://api.wunderground.com/<key>.json .  I did provide  parameters for the below, but still i cannot see it. Also I am not sure what would be the WebIDESystem would be as this is public api.

WebIDEEnabled = true

WebIDESystem = ??? for public api what would be this???

WebIDEUsage = odata_gen.

Coming to my second question.

As we can consume json service from ABAP. I was thinking to consume the json in Odata service(SAP) and as the destination to Gateway servers is already available, this service would show up while creating a project from template.

Not sure if this approach right.

Thanks,

Gopi

former_member182372
Active Contributor
0 Kudos

from

API | Weather Underground

JavaScript with jQuery

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script> jQuery(document).ready(function($) { $.ajax({ url : "http://api.wunderground.com/api/Your_Key/geolookup/conditions/q/IA/Cedar_Rapids.json", dataType : "jsonp", success : function(parsed_json) { var location = parsed_json['location']['city']; var temp_f = parsed_json['current_observation']['temp_f']; alert("Current temperature in " + location + " is: " + temp_f); } }); }); </script>


you don't need destination for using their services as they support javascript

gopi_nidjelli2
Participant
0 Kudos

thank you.

     I have a similar requirement where i need to call the api of 3rd party and update the information.

with the above approach of directly calling the service, Can I use the offline Kapsel project template?

When I call this 3rd party api the app has to work in offline mode too.

Any inputs is appreciated.

Thanks,

Gopi

former_member182372
Active Contributor
0 Kudos

i am not sure how that service will work offline as it pulls an actuall data, you would need to research the api