Calculate distance between two areas

Calculate distance between two areas

Dear creator's community

I need help with this api request, I checked on the support online and on the form but it’s very confusing for me because there are different type of supports between the old version and the new version,

I would like to get the api for the distance matrix between two area.

 I've tryed to create this code but of course doesn't work

MapResponse = getUrl((("https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=" + input.Origin) + "&destinations=" + input.Destination) + "&key=A*****************************M");

Tot_KM = MapResponse.executeXPath("/distance/value()");

 

My goal is to get the distance between two area that my user insert, I would like that the result will be in a “Tot km” field.

 

I used a debug on user input.

I will attached here the json answer:

 

{
 
"status": "OK",
 
"origin_addresses": [ "Vancouver, BC, Canada", "Seattle, État de Washington, États-Unis" ],
 
"destination_addresses": [ "San Francisco, Californie, États-Unis", "Victoria, BC, Canada" ],
 
"rows": [ {
   
"elements": [ {
     
"status": "OK",
     
"duration": {
       
"value": 340110,
       
"text": "3 jours 22 heures"
      },
     
"distance": {
       
"value": 1734542,
       
"text": "1 735 km"
      }
    }, {
     
"status": "OK",
     
"duration": {
       
"value": 24487,
       
"text": "6 heures 48 minutes"
      },
     
"distance": {
       
"value": 129324,
       
"text": "129 km"
      }
    } ]
  }, {
   
"elements": [ {
     
"status": "OK",
     
"duration": {
       
"value": 288834,
       
"text": "3 jours 8 heures"
      },
     
"distance": {
       
"value": 1489604,
       
"text": "1 490 km"
      }
    }, {
     
"status": "OK",
     
"duration": {
       
"value": 14388,
       
"text": "4 heures 0 minutes"
      },
     
"distance": {
       
"value": 135822,
       
"text": "136 km"
      }
    } ]
  } ]
}



    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方