Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am new to Web API and I have a Class Library I would like other applications to access via an ASP.NET Web API site.

The problem I have is that I do not know how to call methods that have multiple input objects some of which are custom entities (they all have several variables inside them and come from the Class Library which I don't have access to change).

Here is an example of one of the methods my API Controller

public bool Process(IBusinessObject businessObject, BusinessValidationObject businessValidationObject, IList<string> messages)
    {
        //Code to call Class Library is here that requires the 3 inputs
    }

Is the above bit of code a valid API method?

I would like to call that method from another ASP.NET Web Application (an MVC application in another solution which will be installed on another server). I have had a look at the Web API Client Libraries but I can't see a way to pass in multiple objects.

Anyone have any ideas?

share|improve this question

1 Answer

up vote 3 down vote accepted

You can only post one complex object.

A solution might be to create an object that contains all three of the objects that you are trying to pass.

share|improve this answer
Thanks. I had a feeling that was the case. I think I may just do as you suggested and put all 3 items into a single item. – amardilo Nov 19 '12 at 15:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.