none
How to Pass Date values in a URITemplate in REST wcf Service? RRS feed

  • Question

  • Hi all, 

      The service am exposing via REST WCF architechture takes the following parameters.

    fromdate = 06/06/2014

    todate = 07/30/2014

    username= raju

    curvenames = HSVGO/CCIFNWE/OUT

    How can I add them in my URI TEMPLATE.

     [WebGet(UriTemplate = "CallDatatDirectService/{userName}/{fromDate}/{toDate}/{curveNames}/{userName}")]
            string CallDatatDirectService(string userName,string fromDate, string toDate, string curveNames);

    the service is working.. but how can i check it by adding dates in the browser? and if i check it by a test client it says "No EndPoint found"

      

    Thursday, July 10, 2014 7:00 AM

Answers

  • Hi,

    Since your UriTemplate is "CallDatatDirectService/{userName}/{fromDate}/{toDate}/{curveNames}/{userName}", so we can not use the "/" in the string parameter.

    Besides, you have used two "userName" in your UriTemplate, then when I test it in my side, it throws error. So please try to use only one "userName" for instead.

    Then please try to modify your UriTemplate as following:
    UriTemplate = "CallDatatDirectService/?p1={userName}&p2={fromDate}&p3={toDate}&p4={curveNames}"

    For more information, please try to refer to:
    #UriTemplate:
    http://msdn.microsoft.com/en-us/library/system.uritemplate(v=vs.110).aspx .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, July 11, 2014 2:32 AM
    Moderator

All replies

  • Hi,

    Since your UriTemplate is "CallDatatDirectService/{userName}/{fromDate}/{toDate}/{curveNames}/{userName}", so we can not use the "/" in the string parameter.

    Besides, you have used two "userName" in your UriTemplate, then when I test it in my side, it throws error. So please try to use only one "userName" for instead.

    Then please try to modify your UriTemplate as following:
    UriTemplate = "CallDatatDirectService/?p1={userName}&p2={fromDate}&p3={toDate}&p4={curveNames}"

    For more information, please try to refer to:
    #UriTemplate:
    http://msdn.microsoft.com/en-us/library/system.uritemplate(v=vs.110).aspx .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, July 11, 2014 2:32 AM
    Moderator
  • Thank you Amy.

    Friday, July 11, 2014 6:46 AM