SaaS CMS has officially launched! Learn more now.

Eric Hubert
Nov 19, 2020
  3109
(2 votes)

What is the REST API and why should I use it?

In this blog post, I like to introduce you to Episerver Campaign's latest Application Programming Interface (API) following the modern architectural style of Representational State Transfer (REST). I will show you its advantages over our traditional HTTP mail/form and SOAP web services as well as give you some tips to quickly get started.

RESTful web services are based on the principles and behavior of the World Wide Web. They enable consumers to access and manipulate textual representations of web resources using a standardized set of stateless operations (HTTP methods). Responses contain status information about the outcome of request processing (e.g. they can confirm state modifications to a resource or indicate non-existing resources or processing errors) which also follow internet standards, see the Internet Engineering Task Force (IETF) RFCs 7230-7235.

Advantages of the REST API

In addition to its simplicity, ease of use and great interoperability which increase the development and integration productivity, the REST API also brings the following advantages:

  • Support of other data formats than XML; we use the more compact JSON by default
  • JSON results in faster parsing, less network bandwidth usage and offers better support of browser clients (e.g. JavaScript)
  • Superior performance, particularly through caching of information that is not altered and not dynamic
  • More scalable (e.g. no use of sessions)
  • Simple and dynamic documentation based on the OpenAPI specification supporting convenient features like "Try it out" (see below)

Therefore, we focus our own development efforts on the REST API. Existing features of our HTTP and SOAP APIs are continuously integrated in our REST API. Newer features like Smart Campaigns are only available in the REST API. You can find a list of all currently available endpoints in our resource documentation.

Tips for working with the Episerver Campaign REST API

To use the REST API, you need an Episerver Campaign client set up for this purpose, and an API user with credentials to authenticate. Once set up, you can test and use the REST API either directly from our resource documentation using the "Try it out" feature or using any HTTP/REST client of your choice like Postman, Insomnia, Paw or the command-line tool CURL.

Each REST API endpoint URL is built according to the following schema: https://api.campaign.episerver.net/rest/{clientId}/{component}/{path}?{parameters}.

The "clientID" parameter is the ID of your client in which the REST API has been set up and represents the root element of each endpoint. You can find the client ID in Episerver Campaign under Administration > API overview > REST API.

When performing API calls, you receive response status codes for each request. In addition to the response status code, you should always process an existing response body to either retrieve the representation of the resource or additional information about business errors.

Try it out and share your experience

Please feel free to use the REST API and integrate Episerver Campaign's rich functionality into your system or develop your own solution!

You are also welcome to check the Episerver Campaign blog from time to time - there will be more posts about the REST API, new features, and endpoints in the future.

If you like, you can also blog yourself or discuss APIs and integrations with other developers in the Episerver Campaign forum.

Nov 19, 2020

Comments

Please login to comment.
Latest blogs
Creating Custom Actors for Optimizely Forms

Optimizely Forms is a powerful tool for creating web forms for various purposes such as registrations, job applications, surveys, etc. By default,...

Nahid | Jul 16, 2024

Optimizely SaaS CMS Concepts and Terminologies

Whether you're a new user of Optimizely CMS or a veteran who have been through the evolution of it, the SaaS CMS is bringing some new concepts and...

Patrick Lam | Jul 15, 2024

How to have a link plugin with extra link id attribute in TinyMce

Introduce Optimizely CMS Editing is using TinyMce for editing rich-text content. We need to use this control a lot in CMS site for kind of WYSWYG...

Binh Nguyen Thi | Jul 13, 2024

Create your first demo site with Optimizely SaaS/Visual Builder

Hello everyone, We are very excited about the launch of our SaaS CMS and the new Visual Builder that comes with it. Since it is the first time you'...

Patrick Lam | Jul 11, 2024

Integrate a CMP workflow step with CMS

As you might know Optimizely has an integration where you can create and edit pages in the CMS directly from the CMP. One of the benefits of this i...

Marcus Hoffmann | Jul 10, 2024

GetNextSegment with empty Remaining causing fuzzes

Optimizely CMS offers you to create partial routers. This concept allows you display content differently depending on the routed content in the URL...

David Drouin-Prince | Jul 8, 2024 | Syndicated blog