cancel
Showing results for 
Search instead for 
Did you mean: 

Consume and Filter REST API file

former_member715858
Participant
0 Kudos

Hello Expert.

can someone advise and help me how to filter the data coming from the following rest element and filter a data to show only a certain data based on type , then once the user select the type, it will then start answering question regarding his selection .

e.g. https://sampleserver5.arcgisonline.com/arcgis/rest/services/?f=pjson

1. first I need to show as selection (quick reply or list) "type": "MapServer" either from the folder or from the services.

2. assume the user select Energy which is https://sampleserver5.arcgisonline.com/arcgis/rest/services/Energy

then also a list of Map services should be available as quick reply

3. assume that the user select need to know information about Fault ( (https://sampleserver5.arcgisonline.com/arcgis/rest/services/Energy/Geology/MapServer/0)

Like, How many overall fault = answer is 18

For how many employee = 3

name of employee = null

65321

Tuigh

How Many records for employee 65321

there is current 5 fault registered for this employee id

4. what are the fault type ?

Thrust Fault (1)

Ductile (1)

SHARE ZONE (1)

Normal fault (1)

rigt-lateral strike-slipe (1)

can some please help

Regards

View Entire Topic
Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

#1

You create a Send Message of type Custom, and then you take the button template and make something like this:

{
  "type": "quickReplies",
  "delay": "",
  "markdown": false,
  "content": {
   "title": "Here is what we have for you!",
    "buttons": [
    {{#eachJoin api_service_response.default.body.services}}
      {{#eq  type "MapServer" }}
      {
        "title": "{{name}}",
        "value": "Buy"
      }
      {{/eq}}
      {{/eachJoin}}
    ]
  }
}

There might be a more elegant way for filtering only the MapServer items, but I'm not Handlebars expert. If there is a way to filter on the API call, that is preferred

#2 You would basically take the input from #1 and run the API and use a custom message again.

#3 I did not quite understand what you wanted.

I also don't understand the flow of your bot, but you could create a skill to provide the final info, and make #1 and #2 a requirement, and #3 would be the action.

former_member715858
Participant
0 Kudos

Dear Daniel,

So much appreciate your time and valuable information .

The training material you mentioned is amazing, clear and so easy to follow .

Many Thanks for your time and illustration demo.

Best Regards,