To update a location or to create a new location use the MetaLocator.setLocation api function call.

MetaLocator.setLocation

Use our API Test tool to obtain the latest documentation on this and other API methods.

Parameters:

Username (String) : Your MetaLocator Username
Password (String) : Your MetaLocator Password
Struct (String): An XML RPC Struct representing the location.

The XML Struct is formatted as follows:

<struct>
<member><name>Field 1 Name</name>
<value><string>Field 1 Value</string></value>
</member>
<member><name>Field 2 Name</name>
<value><string>Field 2 Value</string></value>
</member>

...

<member><name>Field N Name</name>
<value><string>Field N Value</string></value>
</member>
</struct>

Any values containing XML entities must be encoded.

The "id" member, when set, references a specific location id to update.  When the id member is not provided, the API will create a new location.

If an external key is set, and provided as a "member", the system will update the record with the corresponding external key, allowing you to omit the "id" member.

Categories

To set Categories associated with the location, provide members as in this example below (note that Categories are referred to as "tags" in the code):

...
        <member><name>tag1</name>
<value><string>11</string></value>
</member>
<member><name>tag2</name>
<value><string>32</string></value>
</member>
 

Where "11" and "32" above are the ID's of the Category, as indicated in the ID column of your list of Categories.

If no categories are provided, the record will have all categories removed from the record.

The values "11" and "32" above could also be replaced with the name of the category.

You can also refer to categories by "category1" and "category2" and so forth.  Example shown below also uses the category name instead of the Category ID.

     <member><name>category1</name>
<value><string>Gold</string></value>
</member>
<member><name>category2</name>
<value><string>Distributor</string></value>
</member>

When names are used instead of IDs, and the system receives a category name that does not exist, it will be created.  

Category indexes must be sequential and begin from 1.  For example, the below will *not* work:

     <member><name>category8</name>
<value><string>Gold</string></value>
</member>
<member><name>category2</name>
<value><string>Distributor</string></value>
</member>

A complete sample call of the setLocation payload follows:

<param><value><string>example@metalocator.com</string></value></param>
<param><value><string>************</string></value></param>
<param><value><struct>
<member><name>id</name>
<value><string>9</string></value>
</member>
<member><name>name</name>
<value><string>Bark &apos;n Purr Doggy DayCare</string></value>
</member>
<member><name>description</name>
<value><string></string></value>
</member>
<member><name>published</name>
<value><string>1</string></value>
</member>
<member><name>address</name>
<value><string>4604 Burnet Road</string></value>
</member>
<member><name>address2</name>
<value><string></string></value>
</member>
<member><name>city</name>
<value><string>Auston</string></value>
</member>
<member><name>state</name>
<value><string>Texas</string></value>
</member>
<member><name>postalcode</name>
<value><string>78756</string></value>
</member>
<member><name>country</name>
<value><string>United States</string></value>
</member>
<member><name>date</name>
<value><string></string></value>
</member>
<member><name>startdate</name>
<value><string>0000-00-00 00:00:00</string></value>
</member>
<member><name>enddate</name>
<value><string>0000-00-00 00:00:00</string></value>
</member>
<member><name>phone</name>
<value><string>123-123-1232</string></value>
</member>
<member><name>hours</name>
<value><string></string></value>
</member>
<member><name>fax</name>
<value><string></string></value>
</member>
<member><name>link</name>
<value><string></string></value>
</member>
<member><name>email</name>
<value><string></string></value>
</member>
<member><name>icon</name>
<value><string></string></value>
</member>
<member><name>tld</name>
<value><string></string></value>
</member>
<member><name>image</name>
<value><string></string></value>
</member>
<member><name>metadescription</name>
<value><string></string></value>
</member>
<member><name>metakeywords</name>
<value><string></string></value>
</member>
<member><name>language</name>
<value><string>en-US</string></value>
</member>
<member><name>lng</name>
<value><string>-97.7408795</string></value>
</member>
<member><name>lat</name>
<value><string>30.3171592</string></value>
</member>
<member><name>tag1</name>
<value><string></string></value>
</member>
<member><name>tag2</name>
<value><string></string></value>
</member>
<member><name>publishstart</name>
<value><string></string></value>
</member>
<member><name>publishend</name>
<value><string></string></value>
</member>
</struct></value></param>

If a latitude and/or longitude is not provided, locations will be geocoded by our background geocoder using it's internal scheduling and prioritization.  The background geocoder only works for locations uploaded via this API.

Did this answer your question?