Testing WCF API with path parameters in Postman

I am creating an API with WCF (C #) and testing it with Postman. It seems that I'm having problems using the "Params" section in Postman, since it will convert any key value pairs that I entered into Parallel Params.

My contract defines a UriTemplate so ...

    [OperationContract]
    [WebGet(UriTemplate = "/GetClientDataFromAlias/Alias/{alias}", 
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json)]
    GetClientDataFromAliasResponse GetClientDataFromAlias(string alias);

However, when I run the request through Postman, the URL is converted to the following ...

http://troikawcf.localhost/ClientWCFService.svc/GetClientDataFromAlias?Alias=myalias

What I would like to translate is the following: comply with my contract

http://troikawcf.localhost/ClientWCFService.svc/GetClientDataFromAlias/Alias/myalias

Am I missing a setting in Postman to set all parameters in Path format? Or do I need to change my contract to use Query String Parameters?

For more information, see the screenshot below ...

Many thanks

enter image description here

+4
3

, .

URL Postman, "Params" . URL. URL- "Params" .

Path URL-, , placeholder . "" "". "", .

: -   http://troikawcf.localhost/ClientWCFService.svc/GetClientDataFromAlias/Alias/:Alias

: "

Path params in postman , - , , REST Path Params.

+4

, cURL Postman. , . Fiddler4, .

+1

A UriTemplate ( MSDN):

, (/). , ( [{}], )

. , /.... .


, URL- -:

Thesa - , : GetClientDataFromAlias/{alias}

  • :

/, GetClientDataFromAlias?Alias=myalias

Params Postman Postman / , ,

/.

, , key/value Postman URL-

+1
source

Source: https://habr.com/ru/post/1674732/


All Articles