I have a WCF Rest service that is making a call to a remote server. The service sends some of the parameters as Query parameters (dynamic) and some as static. The static parameters are already configured in web.config as appkeysettings :
<appsettings>
<add key="importfolderpath" value="C:/Users/preprod/Documents/FlexCBS/Import">
<add key="securitytoken" value="45e29ad9-3a41-4203-8a24-43ee6a7d6aaf">
When i attempt to invoke the request in Postman i get '400 Bad Request' . I have since realised i need to encode part of the request that contains a slash:
{
"MediaReference": “HRE/MVE/Q/000003276”
}
The original endpooint is :
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "/FlexcubeConfirmationWraped?MediaReference={MediaReference}&BankAccountCode={BankAccountCode}&BillRefNumber={BillRefNumber}&MediaTypeCode={MediaTypeCode}&CurrencyCode={CurrencyCode}&Reference={Reference}&Amount={Amount}", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
string FlexcubeTransactionConfirmationWraped(string MediaReference, string BillRefNumber,string Amount, string BankAccountCode, string CurrencyCode, string Reference, string MediaTypeCode);
Am i doing this correct ? Any help on how i can encode a certain part of UriTemplate
What I have tried:
I have tried encoding the request below but im getting a syntax error at this comma immediately before
BodyStyle
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "/FlexcubeConfirmationWraped?BankAccountCode={BankAccountCode}&BillRefNumber={BillRefNumber}&MediaTypeCode={MediaTypeCode}&CurrencyCode={CurrencyCode}&Reference={Reference}&Amount={Amount}" + HttpUtility.UrlEncode("MediaReference") + ,BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
string FlexcubeTransactionConfirmationWraped(string MediaReference, string BillRefNumber,string Amount, string BankAccountCode, string CurrencyCode, string Reference, string MediaTypeCode);