How to consume web API with authentication in Excel 2010

admin

Administrator
Staff member
I have an exmaple of mvc 4 web API , and I want to consume it in Excel 2010. whats the easiest way to do it? I am thinking to pass in the username and password as string parameter if solution need to be complicated.

Code:
        [Authorize]
        public class AccountBalanceApiController : ApiController
        {
            //http://localhost/FTAccounting/api/AccountBalanceApi?companyId=16&fiscalYear=2012
            public Dictionary<int, TrialBalanceAccountSummaryModel> Get(int companyId, int fiscalYear)
            {
                return AccountBalance.GetTrialBalance(companyId, fiscalYear);
            }
        }

Update: Web service Authentication is not possible in Excel. Reference from <a href="http://cwebbbi.wordpress.com/2012/07/31/using-the-webservice-function-in-excel-2013/" rel="nofollow">http://cwebbbi.wordpress.com/2012/07/31/using-the-webservice-function-in-excel-2013/</a>