geoapify API

geoapify API

I'm unsure how to do this. This url "https://api.geoapify.com/v1/boundaries/part-of?lon=-94.9368478&lat=38.7965975&apiKey=c5d7af51995f42b7b310e0554604e9dc" shows a bunch of info. I'm sorry as I'm not familiar with coding, so I apologize if I do not make sense.
But, if you click the link, I need the info "name":"Johnson County". I have a field called City_Limits where I would like the value "name" to be inputed into City_Limits field. Is this possible? I can't seem to figure it out and I asked Chatgpt but it's telling me to do JSON functions etc. Any help would be amazing.
I would do an openurl and put Lat & Long fields in replace of link above, but not sure how to pull that info back into my form I called it from. Thanks. 

Chatgpt told me to do this and maybe you can help me figure this out or how to do this. 

// Custom function to retrieve city name from Geoapify API
// Parameters: latitude, longitude
// Returns: city name

// Function to make HTTP GET request
function makeHttpGetRequest(url) {
  // Set up the HTTP request
  req = new HTTPRequest();
  req.setURL(url);
  req.setMethod("GET");

  // Send the HTTP request and retrieve the response
  res = req.send();

  // Return the response
  return res;
}

// Function to extract city name from JSON response
function extractCityName(response) {
  // Find the starting and ending positions of the city name
  startIndex = instr(response, "name\":\"") + 7;
  endIndex = instr(startIndex, response, "\",");
  
  // Extract the city name
  cityName = response[startIndex:endIndex];

  // Return the city name
  return cityName;
}

// Custom function to retrieve city name based on latitude and longitude
function getCityName(latitude, longitude) {
  // Construct the API URL with the latitude, longitude, and API key
  apiUrl = "https://api.geoapify.com/v1/boundaries/part-of?lon=" + longitude + "&lat=" + latitude + "&apiKey=API KEY";

  // Make the HTTP GET request
  response = makeHttpGetRequest(apiUrl);

  // Extract the city name from the response
  cityName = extractCityName(response);

  // Return the city name
  return cityName;
}



    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now