Add one new service, UserService.cs
Only POST verb is allowed
Using PostMan to do the test
Using Advanced Rest Client to do the test
Add one new service, UserService.cs
Only POST verb is allowed
Using PostMan to do the test
Using Advanced Rest Client to do the test
All dependencies will be installed too
After installation, you will several references have been included
http://servicestack.net, click the Documentation button
Click Create your first webservice
This page is for non MVC application, so scoll down to the link for MVC
Click the link below:
Copy the content of Web.config
Other steps
Add “Api” folder and one class, “HelloService.cs”.
Code separate into 3 parties:
1. Service
2. Request
3. Response, the name is always requestName+Response
Using the service that we just created
The default web site URL has error, it is no doubt
Has to add “/api” to see available web services, but it’s still fail so far
Check the error message, we forgot to new an AppHost() in Application_Start() in Global.asax
So add the code, “new ProteinTrackerAppHost().Init();” in Application_Start() function
Now it works, and showing following screen.
One operation shows, Hello. It supports different format, XML, JSON, JSV, CSV, …etc.
Click JSON, for example.
Two routes are available for this service
Using /api/hello/xxx to consume the web service
In json format
In xml format