Updating customer shipping address via Zoho Inventory API

Updating customer shipping address via Zoho Inventory API

My client is looking to add a functionality that will allow Zoho inventory to automatically update the City, State and Country fields on a customer record based on a zip code that they've entered. For example - if they enter 92705 as a zip code (US zipe code) the system will automatically update the following: City: Santa Ana, State: California, Country: United States

I was able to write a custom function that looks at the customer record, and calls the google maps API to retrieve the City, State and Country. I'm able to retreive the data i need from google maps API but running into an issue when trying to take the values i retrieved and update the customer shipping address. Below is the code i've used which doesn't work:

city = address.get(1).getJSON("long_name");  //parsing the Jason I received from google

state = address.get(3).getJSON("long_name");  //parsing the Jason I received from google

country = address.get(4).getJSON("long_name"); //parsing the Jason I received from google

mp = Map();  //declaring the response variable

mp.put("shipping_address[city]",city);

mp.put("shipping_address[state]",state);

mp.put("shipping_address[country]",country);

update = zoho.inventory.updateRecord("Contacts",organizationID,customerID,mp);


Looking at the JSON format I get using the GET command for a customer it seems like Shipping_address is on a nested level in the JSON (see attached file). I'm trying to figure out the correct syntax to update the shipping address. Any guidance/direction will be much appreciated! 
    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 コンテンツ




                              ご検討中の方