Get REST Call is not returning the string I put in url
Posted
by
wizage
on Stack Overflow
See other posts from Stack Overflow
or by wizage
Published on 2012-06-18T21:32:17Z
Indexed on
2012/06/19
3:16 UTC
Read the original article
Hit count: 141
I have very simple code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace Calculator.Controllers
{
public class CalcController : ApiController
{
public string Get(string type)
{
return type;
}
}
}
And this is what it returns when I type in http://www.example.com/api/calc/test
<string xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" i:nil="true"/>
When I use http://www.example.com/api/calc/?test=test it returns this:
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">type</string>
How to I make it so I can just do the top one instead of the bottom one?
© Stack Overflow or respective owner