0

I've worked on Java projects before where we created APIs like:

Request URL: http://mindjet.com/api/accounts/dc074c20-580a-4544-a5f2-6d33b1dc04f8

.NET is a different story though, I'm using .NET WCF services and I end up with something not so nice as those that looks like:

Request URL: http://localhost:65113/Services/Record.svc/search/report/4146/page/1

Is there anyway to remove the .svc part ( minor I know but still )?

Also, I can't seem to get the post to work with a URITemplates? The only way I'm able to get it to work is something like this:

[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json)]
public void Send(EmailDetails details) { ... }

$.ajax({
        type: 'POST',
        url: 'Services/Email.svc/Send' 
})

Thanks!

amcdnl
  • 8,470
  • 12
  • 63
  • 99
  • 4
    A `GUID` is nicer than what yo have for the WCF service? – zimdanen Oct 18 '13 at 14:51
  • 1
    Use WebAPI instead of WCF and configure your routes, or use some means of URL rewriting at the server-level. – vcsjones Oct 18 '13 at 14:52
  • @zimdanen not the same service, was just using the java one as an example ... – amcdnl Oct 18 '13 at 15:00
  • .svc is required, assuming you are hosting the WCF in IIS. IIS requires an extension to know which modules to load, .svc helps it identify as WCF. As jones suggested use WebAPI, they are designed to help web calls supports JSON and XML formatting automatically – SridharVenkat Oct 18 '13 at 15:03
  • .svc is NOT requried. WCF 4 has file-less service activation capability. See this [SO: Eliminate the .svc in the URL of a WCF 4 service using Routes?](http://stackoverflow.com/questions/3292908/eliminate-the-svc-in-the-url-of-a-wcf-4-service-using-routes) – Petar Vučetin Oct 18 '13 at 17:49

0 Answers0