Skip to main content

API: .NET Example

Written by Bryan Nye
Updated this week

This article describes an older Legacy API. Customers should upgrade to our latest REST API.

This example shows the use of the MetaLocator XMLRPC API with the library freely available from xml-rpc.net.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CookComputing.XmlRpc;

namespace MetaLocatorXMLRPCAPIExample
{

    public partial class Form1 : Form
    {

        [XmlRpcUrl("https://admin.metalocator.com/xmlrpc")]
        public interface IUpsertLocations : IXmlRpcProxy
        {
            [XmlRpcMethod("MetaLocator.upsertLocations")]
            void upsertLocations(string username, string password, string prevent, string skip, XmlRpcStruct rows);
        }

        public Form1()
        {
            InitializeComponent();

            IUpsertLocations proxy = (IUpsertLocations)XmlRpcProxyGen.Create(typeof(IUpsertLocations));

            XmlRpcStruct row1 = new XmlRpcStruct();

            row1.Add("header", "Name,Description,Published,Address,Address2,City,State,PostalCode,Phone,Date,Country,Link,Email,language,lat,lng,StoreNo");
           
            row1.Add("row1","\"Sample FROM API Location, LLC\",,1,2301 MetaLocator Way,,Denver,Colorado,80205,303-325-5912,,United States,,,en-US,,,25");
            row1.Add("row2", "\"Sample 2 FROM API Location, LLC\",,1,2301 MetaLocator Way,,Denver,Colorado,80205,303-325-5912,,United States,,,en-US,,,25");

            proxy.upsertLocations("InsertYourUsername", "InsertYourPassword", "1", "0", row1);

        }
    }
}
Did this answer your question?