View data from consumed REST service
Question

I have three questions:

1. Is there a way of auto refreshing data from a consumed RESTful service say after every 5mins?

2. Can I view data from a RESTful service like I would when I right click normal entity -> show data, without building a UI for it? This is not an option on structures which are created when you consume a REST service.

3. Can I copy data from structures to identical entities?

mvp_badge
MVP
Solution

Hi Mganda,

  1. Like I said, it depends on what you want to do. If you want to store the data from the REST service in the database, a Timer would be the way to go. If you also want to refresh the screen and show the updated data, you will need some JavaScript to achieve that. For example, a piece of JavaScript that presses a hidden button every once in a while, so that a Screen Action can then query the data from the database.
  2. There's no alternative, JSON is the best you can get.
  3. You don't need to create the Entity exactly like the Structure, if the REST service is some 3rd party service you are calling it would make sense to use your own naming convention for the Entity, but that's up to you. I'm not sure what you mean by "importing" the data; if you create a Timer that retrieves the data, you would typically loop over the list of records and store that data to the database.

Hello maganda,

1) it is possible to refresh your rest API using timer.

2) you will check your data from service center 

   Go to Service center - monitoring - integration log 

3) it is possible to pass structure and create ideal entity to save or strong API response

Thanks and Regards,

Akshay Deshpande

Thanks Akshay.

I am not able to view my data on service center as you suggested.
See image attached.


OS.PNG

Hello mganda,

That's only visible when you hit that API. Using browser,timer,etc. That time you got request and response in integration.

For testing purpose at consume time you will test API as kilian already said.

Thanks 

mvp_badge
MVP

Hi Mganda,

In addition to what Akshay says, you also need to increase the logging level of the REST API. I wrote something about that a while ago.

mvp_badge
MVP

Hi Mganda,

  1. That depends on what you want to achieve. You can of course build a timer that runs every 5 minutes, but that won't update the data on your screen. If you want that, you'll have to resort to JavaScript.
  2. If you double click a consumed REST API Method, there's a "Test" tab you can use to test the method. The response will be returned as JSON, so it's not nicely formatted as with Entities. However, since REST methods typically return nested lists, you can't represent that in nice tables.
  3. Yes you can. If there's a 1:1 correspondance Service Studio will map the Attributes automatically, if there's not a 1:1 correspondance you need to do that manually (Service Studio will show the Attributes to map in that case, auto-filling those that is has guessed based on data type and name).

Thank you Kilian,
Follow up comments and questions....

1. My intention is to have data synched with data from the source, that would mean refreshing the service on a regular interval. I would like to automate this process. A timer would help I hope because of my inadequate JavaScript knowledge.

2. Yes I see JSON data, just like it is when you consume the service. As you mentioned, it is not as good to look at as it is in an entity format(tabular).

3. I have created my entity to match the structure exactly, how do I go about importing data to the entity and can it also be auto-refreshed or it is a one time deal only?

mvp_badge
MVP
Solution

Hi Mganda,

  1. Like I said, it depends on what you want to do. If you want to store the data from the REST service in the database, a Timer would be the way to go. If you also want to refresh the screen and show the updated data, you will need some JavaScript to achieve that. For example, a piece of JavaScript that presses a hidden button every once in a while, so that a Screen Action can then query the data from the database.
  2. There's no alternative, JSON is the best you can get.
  3. You don't need to create the Entity exactly like the Structure, if the REST service is some 3rd party service you are calling it would make sense to use your own naming convention for the Entity, but that's up to you. I'm not sure what you mean by "importing" the data; if you create a Timer that retrieves the data, you would typically loop over the list of records and store that data to the database.
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.