---
title: Manipulating data using REST
related:
  - https://docs.kentico.com/13/integrating-3rd-party-systems/xperience-rest-service/authenticating-rest-requests.md
  - https://docs.kentico.com/13/integrating-3rd-party-systems/xperience-rest-service/getting-data-using-rest.md
  - https://docs.kentico.com/13/integrating-3rd-party-systems/xperience-rest-service/sending-rest-requests-from-code.md
---

> 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).

The REST service allows you to manipulate the data of pages and objects on Xperience instances.

Send requests using the **POST**, **PUT** or **DELETE** [HTTP method](http://en.wikipedia.org/wiki/HTTP#Request_methods) to the appropriate URL. See the following documentation pages for details:

- [Managing pages using REST](https://docs.kentico.com/13/integrating-3rd-party-systems/xperience-rest-service/manipulating-data-using-rest/managing-pages-using-rest.md)
- [Managing objects using REST](https://docs.kentico.com/13/integrating-3rd-party-systems/xperience-rest-service/manipulating-data-using-rest/managing-objects-using-rest.md)

> **Info:** **Data validation**
>
> When inserting or updating data via the REST service, Xperience does not perform any validation. You need to ensure validation on the side of the application sending the REST requests to prevent unwanted behavior.

## General data manipulation parameters

When managing pages or objects via REST, you can append the following query string parameters to the request URL:

| Parameter | Value (default bold) | Description                                                                                                                                                                                                                                                                         |
| --------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| format    | **xml**/json         | Sets the format of the data submitted in POST/PUT requests. For example, append _?format=json_ to the request URL to submit data in JSON format.                                                                                                                                    |
| hash      | hash string          | Allows you to authenticate the request without requiring an authentication header.<br>See [Authenticating REST requests](https://docs.kentico.com/13/integrating-3rd-party-systems/xperience-rest-service/authenticating-rest-requests.md) to learn how to generate the hash value. |

## Setting fields to empty values

If you need to set a page or object field to an empty value using a REST request, use the following expression instead of an actual value:

- **##null##** (for data in XML format)
- **null** (for data in JSON format)

The null expression is particularly useful for non-string fields (typically fields storing foreign key IDs), where an empty string value would not produce the desired results.

For example, the following request updates the **Home** page of a sample site and ensures that it does not have a user specified in the **Created by** field:

- **HTTP method**: PUT
- **URL**: \~/rest/content/site/samplesite/en-us/document/Home
- **Data (XML format)**:

  ```xml

  <CMS_MenuItem>
     <DocumentCreatedByUserID>##null##</DocumentCreatedByUserID>
  </CMS_MenuItem>

  ```

## Uploading attachment files

When uploading files via the REST service, use the following format for the binary data:

- **base 64 encoding** in requests using the XML data format
- **byte array** values in requests using the JSON data format

Carefully consider the data type of the target field. Most page and object fields in Xperience do not store binary data directly, but instead contain the GUID of the corresponding attachment object. To find information about the requirements for your scenario, [send a GET request](https://docs.kentico.com/13/integrating-3rd-party-systems/xperience-rest-service/getting-data-using-rest.md) for an existing object of the given type and check the resulting data.

### Example - creating a page with an attachment

The following example shows how to create a new page and attach an image file as its attachment using the REST service.

> **Info:** In order to replicate the example, you need to first [create and configure a page type](https://docs.kentico.com/13/developing-websites/defining-website-content-structure/managing-page-types.md) with the _SampleType.File_ code name and two fields:
>
> - a field with _FileName_ **Field name** and _Text_ **Data type**,
> - and a field with _FileAttachment_ **Field name** and _File_ **Data type**.

To create a new _SampleType.File_ page, including an image file as an attachment:

1. Send a request to create the attachment file itself (**cms.attachment** object type, base64 encoding for the file binary in the **AttachmentBinary** field):
   - **HTTP method**: POST
   - **URL**: \~/rest/cms.attachment/currentsite
   - **Data (XML format)**:

     ```xml

     <CMS_Attachment>
       <AttachmentName>NewAttachmentFile.png</AttachmentName>
       <AttachmentExtension>.png</AttachmentExtension>
       <AttachmentSize>3180</AttachmentSize>
       <AttachmentMimeType>image/x-png</AttachmentMimeType>
       <AttachmentImageWidth>183</AttachmentImageWidth>
       <AttachmentImageHeight>47</AttachmentImageHeight>
       <AttachmentBinary></AttachmentBinary> <!-- Insert base 64 encoded binary data -->
     </CMS_Attachment>

     ```
2. Store the **AttachmentGuid** value from the data of the response to the POST request that created the attachment.
3. Create the _SampleType.File_ page (set the **FileAttachment** field to the GUID of the new attachment object):
   - **HTTP method**: POST
   - **URL**: \~/rest/content/currentsite/en-us/document/Images
   - **Data (XML format)**:

     ```xml

     <SampleType_File>
       <NodeClassID>1685</NodeClassID> <!-- Insert the ClassID of the SampleType.File page type-->
       <FileName>NewAttachmentFile</FileName>
       <FileAttachment>96d6dfc9-4f3a-4a30-95af-4d7cc5a36f9a</FileAttachment> <!-- Insert the GUID of the appropriate attachment object -->
     </SampleType_File>

     ```
4. Store the **DocumentID** value from the data of the response to the POST request that created the new _SampleType.File_ page.
5. Update the data of the attachment object to include the ID of the new page (set the **AttachmentDocumentID** field to the **DocumentID** of the page):

   - **HTTP method**: PUT
   - **URL**: \~/rest/cms.attachment/
   - **Data (XML format)**:

     ```xml

     <CMS_Attachment>
       <AttachmentDocumentID>120</AttachmentDocumentID> <!-- Insert the DocumentID of the page to which the file is attached -->
     </CMS_Attachment>

     ```

> **Info:** To learn more about working with pages, see [Managing pages using REST](https://docs.kentico.com/13/integrating-3rd-party-systems/xperience-rest-service/manipulating-data-using-rest/managing-pages-using-rest.md).
