Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to call RESTful web services methods
    text
    copied!<p>I'm trying to dive into the RESTful web services world and have started with the following template:</p> <pre><code>[ServiceContract] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] public class Test { // TODO: Implement the collection resource that will contain the SampleItem instances [WebGet(UriTemplate = ""), OperationContract] public List&lt;SampleItem&gt; GetCollection() { // TODO: Replace the current implementation to return a collection of SampleItem instances return new List&lt;SampleItem&gt;() {new SampleItem() {Id = 1, StringValue = "Hello"}}; } [WebInvoke(UriTemplate = "", Method = "POST"), OperationContract] public SampleItem Create(SampleItem instance) { // TODO: Add the new instance of SampleItem to the collection throw new NotImplementedException(); } [WebGet(UriTemplate = "{id}"), OperationContract] public SampleItem Get(string id) { // TODO: Return the instance of SampleItem with the given id throw new NotImplementedException(); } [WebInvoke(UriTemplate = "{id}", Method = "PUT"), OperationContract] public SampleItem Update(string id, SampleItem instance) { return new SampleItem { Id = 99, StringValue = "Done" }; } [WebInvoke(UriTemplate = "{id}", Method = "DELETE"), OperationContract] public void Delete(string id) { // TODO: Remove the instance of SampleItem with the given id from the collection throw new NotImplementedException(); } } </code></pre> <p>I am able to perform the GET operation but I am unable to perform PUT, POST or DELETE requests.</p> <p>Can anyone explain me how to perform these operations and how to create the correct URLs?</p> <p>Best regards</p> <p>Alessandro</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload