Documentation

Documentation

  • Documentation
  • Externable.com

›Plugins Development

Introduction

  • Introduction to Externable

Setup

  • Registration
  • Creating Subscription
  • Renaming subscription
  • Setup URL
  • Connecting Dynamics
  • Setting up email
  • Provisioning instance
  • Starting and stopping instance
  • Connecting Custom Domain
  • Upgrading
  • Taking Backups
  • Restoring Backups
  • Resetting Instance
  • Changing Billing Address
  • Changing Subscription Plan

Portal Backoffice Basics

  • Login To Backoffice
  • Navigation In Backoffice
  • Adding & Managing Users

Creating Content

  • Creating, Saving and Publishing Content
  • Scheduling Posts
  • Content Versioning
  • Creating Content Templates
  • Restricting Access To Content
  • Creating Media
  • Sensitive Data
  • RichText Editor
  • Content Tree

Dynamics Integration

  • Default Template
  • Presenting Dynamics Data

    • Creating Dynamics Integrated Content
    • Extracting Dynamics Query

    Dynamics Forms

    • How Forms Work
    • Working with Formulas
    • Example - Create a Form

Languages

  • Enabling Languages
  • Creating Translations

Members

  • Creating Members In The Frontend
  • Creating Members in the Backend
  • Linking Members To Dynamics Contacts

Portal extension

  • Document Types
  • Data Types
  • Property Editors
  • Grid Editors
  • Macros
  • Relation Types
  • LogViewer
  • Templates

    • Templates
    • Razor Syntax
    • Rendering Content
    • Rendering Media
    • Rendering CSS & JS
    • Partial Views
    • Partial Macro Views
  • CSS customizations
  • JavaScript
  • Plugins Development

    • Plugins Development
    • MVC Controllers
    • WebAPI Controllers

Notes

  • Open Source Used

WebAPI Controllers

What is Web API?

If you want to expose your custom plugin as REST API you need to create a custom controller, which will be accessible by HTTP requests. That is especially useful if you want to use some JavaScript components relaying on HTTP requests for retrieving or updating data.

An API Controller is an ASP.NET WebApi controller that is used for creating REST services. These controllers are auto-routed meaning that you don't have to add/create your own routes for these controllers to work.

All implementations of Umbraco Api Controllers inherit from the base class Umbraco.Web.WebApi.UmbracoApiController.

Available to everyone (including annonymous requests)

If you want your API endpoint to be available for everyone without logging, create MVC controller inheriting from Umbraco.Web.WebApi.UmbracoApiController. This is helpful when you want your customer JavaScript components talk asynchonously to your Externable backend (and many more use cases).

Available to logged in members only

Authorizing a controller for a front-end member is achieved with attribute Umbraco.Web.WebApi.MemberAuthorizeAttribute.

You can attribute your controller or action with this attribute which will ensure that a member must be logged in to access the resource.

There are a few properties that exist for the attribute to give you more control over the authorization process for which members can access the resource:

  • AllowType - Comma delimited list of allowed member types
  • AllowGroup - Comma delimited list of allowed member groups

Available to logged in users only

Any WebApi Controller or Action that is attributed with Umbraco.Web.WebApi.UmbracoAuthorizeAttribute will authenticate the request for a backoffice user.

A base class implementation that already exists with this attribute is: Umbraco.Web.WebApi.UmbracoAuthorizedApiController. Since this controller inherits from Umbraco.Web.WebApi.UmbracoApiController it is auto-routed. This controller is also attributed with Umbraco.Web.WebApi.IsBackOfficeAttribute to ensure that it is routed correctly to be authenticated for the backoffice.

Another common base class implementation for the backoffice is Umbraco.Web.Editors.UmbracoAuthorizedJsonController which inherits from Umbraco.Web.WebApi.UmbracoAuthorizedApiController but has some special filters applied to it to automatically handle anti-forgery tokens for use with AngularJS in the backoffice.

Template explained

Our Custom Plugin template contains an example of WebAPI Controller. See it below explained.

Your plugin name must be unique so that you don't face errors due to conflict with other plugins

← MVC ControllersOpen Source Used →
  • What is Web API?
  • Available to everyone (including annonymous requests)
  • Available to logged in members only
  • Available to logged in users only
  • Template explained
Copyright © 2021