Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8509481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:26:46+00:00 2026-06-11T03:26:46+00:00

I have an ASP.NET MVC 4 application that needs to use an existing API

  • 0

I have an ASP.NET MVC 4 application that needs to use an existing API to a different service. It is clear that ApiController’s return data and that regular Controller’s return views.

I need some form of RESTful API to interface to the external API, for Javascript functionality, but my actions (which render views) also need to call the external API. In short, both my controller actions and JavaScript-called API need to make calls to a common external API.

My question is this: How can I architect this so that my actions and the JS API make their calls with a common interface?

My two ideas so far:

  1. Create an ApiController for each entity. These ApiController’s then make calls to the external API. Then, my Javascipt can call these ApiController’s and in my actions, I can create an instance of each ApiController as needed and invoke their methods (GET, POST, PUT, etc.) Does this sound hackish?
  2. Put all business logic into Model objects which then call the external API. To expose certain methods to Javascript, provide some HTTP endpoint and the Javascript passes the name of an action to invoke, which invokes Model methods which then invoke the external API.

Do either of these sounds more “correct” than the other? Or is this just another case of over-worrying and do “whatever you want”? The goal here is simply to invoke some external API in a common way that Javascript and my controller actions can access.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:26:48+00:00Added an answer on June 11, 2026 at 3:26 am

    I would create an API controller that will serve as a bridge between your domain and the external web service. Now both your standard MVC controllers and javascript will consume this API controller. The question here is whether you could make this API controller generic so that it will avoid you the need to create an API controller per entity but use the same one. It would avoid repetition. Whether this is possible would of course depend on your exact scenario.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing ASP.NET MVC 2 application that I've been asked to extend.
I have an ASP.NET MVC web application that makes REST style web service calls
I have an ASP.NET MVC application that uses Fluent NHibernate and AutoMapper. I am
I have an Asp.Net MVC application that works in the vs.net development web server.
I have a ASP.NET MVC application that runs in both IIS 6 and 7.
We have an asp.net mvc application that we would like to integrate a FileSystemWatcher
I have an ASP.NET MVC application that has one part where I dont really
I have an ASP.NET MVC application that uses Linq to SQL repositories for all
Team, I have an ASP.NET MVC application that I'm deploying. When I deploy it
We have an internal ASP.NET MVC application that requires a logon. Log on works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.