Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since you will need to specify the default response format somehow. The behavior you are seeing is standard. You will need to to look and specific headers and determine what the response format should be. You can then implement a request interceptor to figure out what the outgoing response format needs to be. </p> <p>So to answer your question, you will need to stick with a default format type if none is mentioned or return a bad request. REST is more of a paradigm than a protocol unlike SOAP.</p> <p>UPDATE: For clarification sake. You could do something like this.</p> <pre><code>[ServiceContract()] public interface ICustomerService { [OperationContract] [WebGet(UriTemplate ="?format={formatType}",BodyStyle = WebMessageBodyStyle.Bare)] IResponseMessage GetEmCustomers(string formatType); } public class CustomerService : ServiceBase { IResponseMessage GetEmCustomers(string formatType) { try { var isValid = base.validateformatspecification(formatType);// check to see if format is valid and supported if(!isValid) return base.RespondWithError(formatType,new Error {Msg= "Dude we dont support this format"}); var customers = CustomerProvider.GetAll(); return base.Respond(formatType,customer);// This method will format the customers in desired format,set correct status codes and respond. }catch(Exception ex) { // log stuff and do whatever you want return base.RespondWithError(formatType,new Error{Msg = "Aaah man! Sorry something blew up"});// This method will format the customers in desired format,set correct status codes and respond. } } } public class ServiceBase { public IResponseMessage Respond&lt;T&gt;(string format,T entity); public IResponseMessage RespondWithError&lt;T&gt;(string format, T errorObject); } public class Error:IResponseMessage {/*Implementation*/} public class GetEmCustomerResponseResource:List&lt;Customer&gt;,IResponseMessage {/* Implementation*/} public class GetEmCustomerErrorResponse: IResponseMessage {/* Implementation */} </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload