You can read the ref and take a look in the Difference between ApiController and Controller in ASP.NET MVC, since people are commonly confused with them.
Questions tagged [asp.net-apicontroller]
456 questions
0
votes
0 answers
How to parse a PartialView and return a Html string from ApiController?
I need to parse a MVC PartialView then convert it to plain html string and send it as HttpResponseMessage from ApiController.
Searching the web i found RazorEngine and i tried to use it unsuccessfully because it does not support MVC helpers like…

CodeArtist
- 5,534
- 8
- 40
- 65
0
votes
1 answer
.NET MVC controllers and API controllers in the same project
I want to write a collection of Single Page Apps in .NET using MVC and Angular JS (1.x). I would like to manage the bootstrap of each SPA using MVC all within a single project so that the look and feel is consistent using the _Layout and Return…

Aaron Reese
- 131
- 11
0
votes
1 answer
Multiple C# WebAPI API routes - restrict API method to one of the routes
I have multiple routes for my API like
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{token}/{controller}/{action}",
defaults: null,
constraints: null,
handler: HttpClientFactory.CreatePipeline(
…

Jacob
- 113
- 1
- 12
0
votes
1 answer
RouteLink to an API controller not working in MVC 4 with areas
I like to use a link in a view to point a ApiController in an Area. I've tried different kinds of registration. I've tried different overloads of RouteLink. No success. Independent how I register and how I try to get the Link, always ~/ is…

Konrad Brunner
- 11
- 1
0
votes
1 answer
How to deserialize asp.net datetime as JSON datetime with client's timezone
I'm struggling with datetimes a bit. I'm using asp.net mvc api controllers, a microsoft sql server and AngularJS.
On some button click I'm sending a JSON formatted date to an api-controller. When I post 2015-11-31 00:00 and I look in Fiddler to see…

Clark Kent
- 305
- 1
- 4
- 16
0
votes
1 answer
Fetch data from Object type c#
I have a WebAPI controller written in c# which look like this:
public void Post(Object obj)
{
}
Now, using $resource of angularjs I am posting a object like {name: "xyz"} to this controller.
So, obj seems like a object with property "name" and…

mdnajimahmed
- 124
- 2
- 9
0
votes
2 answers
AngularJS can´t call APIcontroller from factory
I have a problem to get response from my API-controller from my factory.
I get error 404 page not found.
I got the right .js-file in the HTML-document and the routing seems fine.
App.js:
module.factory('userFactory', function($http) {
return {
…

Johan Byrén
- 890
- 2
- 13
- 28
0
votes
1 answer
Access Umbraco 7 Content from UmbracoApiController
I have some trouble accessing Umbraco 7 Content from a UmbracoApiController.
This is my ApiController, with sample data, and i want to get real data from the Umbraco Content. How can i access the Umbraco Content?
This is how my Content is…

user1906437
- 233
- 2
- 6
- 12
0
votes
1 answer
Mvc WebApi Querystring to a AddPost method
I'm trying to get the querystring that is in the browser,
an example /UserHome/UserProfile?username=dangercoder. I'm working in WebApi controller
from the following url i want to get "dangercoder" so I can use the dangercoder username in my AddPost…

DangerCoder
- 71
- 2
- 9
0
votes
2 answers
jqgrid calling an api controll post method
I am using jqgrid to retrieve data from api controller post method. I have set the jquery url,datatype and mtype like below.
url: ..api/ControllerName,
datatype: "json",
mtype: 'POST',
Problem 1: But it is not hitting the controller.
Problem 2:…

ozil
- 6,930
- 9
- 33
- 56
0
votes
1 answer
ApiController mangles JSON, throws Angular ng-repeater error
My ApiController method is returning JSON in this…

JMax2012
- 373
- 2
- 6
- 24
0
votes
2 answers
How do I set out Attribute in Api Controller
is it possible to use out attribute in a Api Controller method? I'm using C#.
for exp:
[HttpGet]
public string GetWhatever(string type, string source,out int errorCode, out string errorMessage)
if it is, an example of how to call it and get the…

Michel
- 103
- 6
0
votes
1 answer
Error using MvxMultiPartFormRestRequest to post image/data to API controller
I am building an Android app which has a form that user can post image for an item.
So the post data is an int field and an image.
I use MvvmCross Network plugin to post and got below error. I am a beginner and I do not know where I did wrong:…

zorro-lp
- 147
- 1
- 8
0
votes
2 answers
ApiController routing with non-existing parameters
I have an ApiController like this:
SearchController : ApiController {
public Book Get(int booksn=-1, string author="")
{
/* search for books matching the parameters */
}
}
All parameters have default value and an empty search request…

aymeric
- 25
- 4
0
votes
0 answers
API controller action getting null value after Ajax call
I am getting post as null in My API controller Action GetVoteScores. Where i went wrong?. If any one need more code to check i will give it.
This is my API controller Action
[System.Web.Mvc.HttpGet]
…

Nithin Paul
- 2,169
- 3
- 33
- 55