Je fais appel webservice méthode GET via PowerShell comme ceci:passer des paramètres multiples de requête à WebService via PowerShell
$result = Invoke-WebRequest -Uri https://localhost/MyApi/Foo/blahA/blahB?three=testing&four=2015-09-18T06:45:29.5199432Z
Cependant, cela me donne l'erreur suivante:
The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
- CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
- FullyQualifiedErrorId : AmpersandNotAllowed
S'il importe ici est mon code WebAPI et routage (la méthode a deux paramètres requis, et 3 facultatifs):
[HttpGet, ActionName("Foo")]
public string Foo(string one, string two,
string three = null, DateTime? four = null, int five = null)
{
//do stuff
//return some string
}
...
routes.MapHttpRoute(
name: "Foo",
routeTemplate: "Foo/{one}/{two}",
defaults: new { controller = "Testing", action = "Foo" }
);
Pas un problème, ce sont les choses simples à droite? –