---
title: Configuring the REST service
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

## REST prerequisites

Before you can enable the Kentico REST service, you must ensure the following:

### In Windows

Go to **Control Panel -> Programs and Features** and click **Turn Windows features on or off** in the left menu.

#### Windows 7 / Windows Server 2008

1. Expand the **Microsoft .NET Framework&#x20;**&#x20;node in the dialog window.
2. Make sure that both of the following features are installed:
   - **Windows Communication Foundation HTTP Activation**
   - **Windows Communication Foundation Non-HTTP Activation**

![](https://docs.kentico.com/docsassets/k8/configuring-the-rest-service/3.png)

#### Windows 8 / Windows Server 2012

1. Expand the **.NET Framework 4.5 Advanced Services** node.
2. Make sure that the **WCF Services -> HTTP Activation** feature is installed.

> **Note:** **Error: _"Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel"_**
>
> If your application returns the above error after enabling HTTP Activation, you need to manually register the correct version of ASP.NET.
>
> See <https://msdn.microsoft.com/en-us/library/hh169179%28v=nav.70%29.aspx> for detailed information.

### In IIS Manager

1. Select the website for which you want REST to be enabled.
2. Open the **Authentication** configuration.
3. Ensure that **Anonymous** authentication is enabled. You can also have either **Forms** or **Windows** authentication enabled if required by your environment.
4. Disable **Basic** and other types of authentication (leave _Anonymous_ and either _Forms_ or _Windows_ enabled).

   ![](https://docs.kentico.com/docsassets/k8/configuring-the-rest-service/2.png)
5. Select **Application Pools** in the navigation tree.
6. Double-click the application pool used by your website.
7. Make sure the pool uses **Integrated** Managed pipeline mode.

   ![](https://docs.kentico.com/docsassets/k8/configuring-the-rest-service/1.png)

Once you have these prerequisites met, you can proceed to configuring the REST service in the Kentico instance.

## Configuring the REST service

Once you meet the pre-requisites for using the REST service, configure the following settings for the Kentico instance:

1. Edit your application's **web.config** file.
2. Find the **system.webServer** section directly under the root (i.e. not under a specific __ element).
3. Add the following attribute to the **** element:

   ```html

   <modules runAllManagedModulesForAllRequests="true">

   ```
4. Log in to the Kentico administration interface.
5. Open the **Settings** application.
6. Select the **Integration -> REST** category and configure the settings:

   | REST setting                              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
   | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | Service enabled                           | Enables or disables the Kentico REST service.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
   | Service enabled for                       | Choose if the REST service allows access to objects, documents, or both.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
   | Authentication type                       | Determines which type of [authentication](https://docs.kentico.com/k8/integrating-3rd-party-systems/kentico-rest-service/authenticating-rest-requests.md) the REST service uses. Supported types are **Basic** and **Forms** authentication.<br>**Note**: You can authenticate REST requests using the **hash** query string parameter in both modes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
   | Always check document security            | If disabled, security is not checked when accessing published versions of documents. If enabled, security is always checked.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
   | Document access is read only              | If enabled, the REST service only allows GET requests for documents (documents cannot be modified).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
   | Object access is read only                | If enabled, the REST service only allows GET requests for objects (objects cannot be modified).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
   | Allowed document types                    | Specifies a list of [document types](https://docs.kentico.com/k8/developing-websites/defining-website-data-structure/document-types.md) that the REST service is allowed to access. Enter the code names of document types separated by semicolons.<br>If empty, all document types are allowed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
   | Allowed object types                      | Specifies a list of objects types that the REST service is allowed to access. If empty, all object types are allowed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
   | Generate authentication hash for URL      | Click the link to generate an [authentication](https://docs.kentico.com/k8/integrating-3rd-party-systems/kentico-rest-service/authenticating-rest-requests.md) hash for specific REST URLs.<br>Enter the full absolute URL of the REST request, including the protocol, website domain name, virtual directory, [REST path](https://docs.kentico.com/k8/integrating-3rd-party-systems/kentico-rest-service/getting-data-using-rest.md), and query string parameters. For example:<br>_http://mywebsite.com/rest/content/currentsite/en-us/all/news?format=json_<br>The system adds the authentication hash parameter to the URL. You can copy the URL and use it to perform the REST request without any other type of authentication.<br>**Restrictions**:<br>Only works for GET requests (read only data retrieval)<br>You cannot use hash parameter authentication for _/all_ object retrieval requests (_\~/rest//all_). |
   | Default encoding                          | Sets the character encoding that the REST service uses for requests that do not contain a supported _Accept-Charset_ header.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
   | Allow sensitive fields for administrators | If enabled, REST requests authenticated using the credentials of users with the Global administrator [privilege level](https://docs.kentico.com/k8/managing-users/user-management.md) are allowed to work with data fields that contain sensitive information (for example fields related to passwords).<br>Requests authenticated under non-administrator users can NEVER access sensitive fields, regardless of this setting's value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

### Enabling upload of large data

If you are planning to upload large-size data into Kentico through the REST service, it is necessary to specify the required data size limit in the application's _web.config_ file. This can be done by adding the following pieces of code into the _****_ section at the end of the web.config file:

1. Insert a __ element into the __ sub-section:

   > **Note:** **Note**: This sample sets all limits to 10 MB. You may need to enter different values according to your specific needs.

   ```html

   <webHttpBinding>
     <!-- Limits set to 10 MB (specified value in bytes) -->

     <binding name="RESTQuotaBinding" maxReceivedMessageSize="10485760" maxBufferPoolSize="10485760" maxBufferSize="10485760" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00">
        <readerQuotas maxDepth="32" maxStringContentLength="10485760" maxArrayLength="10485760" maxBytesPerRead="10485760" />
        <security mode="None" />
     </binding>
   </webHttpBinding>

   ```
2. Add a __ element under the __ sub-section:

   ```html

   <service name="CMS.WebServices.RESTService">
      <host>
        <baseAddresses>
          <add baseAddress="http://localhost/KenticoCMS/rest" />
        </baseAddresses>
      </host>
      <endpoint address="" bindingConfiguration="RESTQuotaBinding" binding="webHttpBinding" contract="CMS.WebServices.IRESTService" />
   </service>

   ```

   The _baseAddress_ in the code above only contains a sample value and needs to be replaced with the actual root address of the REST service (depending on your website's domain name).
