2sxc 7.1 offers new, full REST support to get, create, update and delete content. Rest is basically a simple way to target a content-item with a URL and either read, write, delete etc.
The principle is very simple: use an HTTP-Verb like GET, POST, DELETE to access a resource. Example
- GET .../app-content/Feedback
will return all feedback items
- GET .../app-content/Feedback/243
will return the feedback item 243
- POST .../app-content/Feedback
with data like { Subject: "I love your product", Message: "Tried 2sxc, love it" }
will create a new feedback item in the content-database
- POST .../app-content/Feedback/243
with data like { Subject: "Updated Subject"}
will update the subject field and leave the rest untouched
- DELETE .../app-content/Feedback/243
will delete this content item
So what do you need to know to get started?
- By default the REST API only works for users who have at least Admin-permissions. To enable it for anybody else, you need to set the appropriate permissions.
- The root URL of the API can change from system to system. There is an easy way to get the right path.
- DNN increases the security of WebAPI with something called a ServiceFramework. This ensures that only your modules can access the API and other, external sources can't. You need to know how to work with this.
- If you've never used REST APIs before you will probably need some examples how to code the JavaScript using jQuery or AngularJS
Let's get started!