---
title: Managing objects 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/manipulating-data-using-rest/managing-pages-using-rest.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).

To manage objects in Xperience using the REST service, send requests using the POST, PUT or DELETE [HTTP method](http://en.wikipedia.org/wiki/HTTP#Request_methods) to the appropriate URL — append the  _**resource paths**_  described below to the _**base URL**_ of your REST service.

The base URL of the Xperience REST service is **/rest**. For example, if your administration application runs at  _http://localhost/Xperience_, use  _http://localhost/Xperience/rest_  as the base URL of the service.

Object resource paths start with an _**object type**_ value. To find the value for specific object types, open the **System** application in the Xperience administration interface and select the **Object types** tab.

> **Note:** **Important**: Do NOT use object requests to create, update or delete the pages of Xperience websites. 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) for information about working with pages.

## Creating objects

HTTP method: **POST**

Resource format:

- **/** - creates a new object of the specified type.
- **//currentsite** - creates a new object of the specified type and assigns it to the website running on the domain in the base URL.
- **//site/** - creates a new object of the specified type and assigns it to the specified website.
- **/customtableitem.** - creates a new data record inside the specified [custom table](https://docs.kentico.com/13/developing-websites/defining-website-content-structure/managing-custom-tables.md).
- **/bizformitem.bizform.** - creates a new data record inside the specified [form](https://docs.kentico.com/13/managing-website-content/forms.md).

Set the name and other fields of the new object in the data of the POST request. Both [XML](http://en.wikipedia.org/wiki/XML) and [JSON](http://en.wikipedia.org/wiki/JSON) formats are supported for the data.

> **Info:** **Important**:
>
> - The service automatically sets the system fields of the new object (such as the ID and timestamp fields).
> - Creating multiple objects of the same type in a single request is not supported.
> - You can create child or binding objects along with the primary object. When using the XML format for the data of such requests, enclose the data into the _****_ element to ensure valid syntax with a single root element.

### Examples

**Creates a new user with the Editor privilege level and an empty password. Assigns the user to the site running on the domain in the base URL.**

| XML                                                                                                                                                                                                                                                                             | JSON                                                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **URL**: _\~/rest/cms.user/currentsite_<br>**Data**:<br>`  <CMS_User>   <UserName>Editor</UserName>   <FullName>Content editor</FullName>   <Email>editor@localhost.local</Email>   <UserEnabled>true</UserEnabled>   <UserPrivilegeLevel>1</UserPrivilegeLevel> </CMS_User>
 ` | **URL**: _\~/rest/cms.user/currentsite?format=json_<br>**Data**:<br>` 
{
"UserName":"Editor",
"FullName":"Content editor",
"Email":"editor@localhost.local",
"UserEnabled":true,
"UserPrivilegeLevel":1
}
 ` |

**Creates a new _country_ object with a child state**

| XML                                                                                                                                                                                                                                                                                                                                                       | JSON                                                                                                                                                                                                                                              |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **URL**: _\~/rest/cms.country_<br>**Data**:<br>`  <data>   <CMS_Country>     <CountryDisplayName>New country</CountryDisplayName>     <CountryName>NewCountry</CountryName>   </CMS_Country>   <CMS_State>     <StateDisplayName>New state</StateDisplayName>     <StateName>NewState</StateName>     <StateCode>NS</StateCode>   </CMS_State> </data>
 ` | **URL**: _\~/rest/cms.country?format=json_<br>**Data**:<br>` 
{
"CountryDisplayName":"New country",
"CountryName":"NewCountry",
"CMS.State":    [{
    "StateDisplayName":"New state",
    "StateName":"NewState",
    "StateCode":"NS"
  }]
}
 ` |

**Creates a [coupon code](https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/discounts/working-with-coupon-codes.md) for a [discount](https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/discounts.md) (order or free shipping) on a site with code name _sitename_**

| XML                                                                                                                                                                                                                                                          | JSON                                                                                                                                                                                      |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **URL**: _\~/rest/ecommerce.couponcode/site/sitename_<br>**Data**:<br>`  <COM_CouponCode>   <CouponCodeDiscountID>1</CouponCodeDiscountID>   <CouponCodeCode>BLACK_FRIDAY</CouponCodeCode>   <CouponCodeUseLimit>1</CouponCodeUseLimit> </COM_CouponCode>
 ` | **URL**: _\~/rest/ecommerce.couponcode/site/sitename?format=json_<br>**Data**:<br>` 
{
    "CouponCodeDiscountID":1,
    "CouponCodeCode":"BLACK_FRIDAY",
    "CouponCodeUseLimit":1
}
 ` |

**Adds a new data record into the _Sample table_ custom table**

| XML                                                                                                                                                                                | JSON                                                                                                                              |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **URL**: _\~/rest/customtableitem.customtable.sampletable_<br>**Data**:<br>`  <customtable_SampleTable>
  <ItemText>Record added via REST</ItemText> </customtable_SampleTable>
 ` | **URL**: _\~/rest/customtableitem.customtable.sampletable?format=json_<br>**Data**:<br>` 
{"ItemText":"Record added via REST"}
 ` |

## Updating existing objects

HTTP method: **PUT**

Resource format:

- **//** -updates the object with the specified identifier (primary key ID).
- **//** - updates the object with the specified code name. For object types with site bindings, always updates the object assigned to the site running on the domain in the base URL.
- **//site//** - updates the object with the specified code name or GUID value on the specified website.
- **//global/** - updates the global object with the specified code name or GUID value.
- **/customtableitem./** - updates the data record with the specified identifier (ID or GUID value) inside the given [custom table](https://docs.kentico.com/13/developing-websites/defining-website-content-structure/managing-custom-tables.md).
- **/bizformitem.bizform./** - updates the data record with the specified identifier (ID or GUID value) inside the given [form](https://docs.kentico.com/13/managing-website-content/forms.md).

Update the values of the object's fields using the data of the PUT request. Both [XML](http://en.wikipedia.org/wiki/XML) and [JSON](http://en.wikipedia.org/wiki/JSON) formats are supported for the data. Updating multiple objects in a single request is not supported.

### Examples

**Updates the email address of the _administrator_ user**

| XML                                                                                                                                | JSON                                                                                                               |
| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| **URL**: _\~/rest/cms.user/administrator_<br>**Data**:<br>`  <CMS_User>
  <Email>newAddress@localhost.local</Email> </CMS_User>
 ` | **URL**: _\~/rest/cms.user/administrator?format=json_<br>**Data**:<br>` 
{"Email":"newAddress@localhost.local"}
 ` |

**Updates a data record of the sample _Contact us_ form**

| XML                                                                                                                                                                                       | JSON                                                                                                                                                        |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **URL**: _\~/rest/bizformitem.bizform.contactus/1_<br>**Data**:<br>`  <Form_ContactUs>
  <Email>newMail@localhost.local</Email>
  <Message>Updated message</Message> </Form_ContactUs>
 ` | **URL**: _\~/rest/bizformitem.bizform.contactus/1?format=json_<br>**Data**:<br>` 
{
  "Email":"newMail@localhost.local",
  "Message":"Updated message"
}
 ` |

## Deleting objects

HTTP method: **DELETE**

Resource format:

- **//** - deletes the object with the specified identifier (primary key ID).
- **// -** deletes the object with the specified code name. For object types with site bindings, always deletes the object assigned to the site running on the domain in the base URL.
- **//site//** - deletes the object with the specified code name or GUID value from the specified website.
- **//global/** - deletes the global object with the specified code name or GUID value.
- **/customtableitem./** - deletes the data record with the specified identifier (ID or GUID value) from the given [custom table](https://docs.kentico.com/13/developing-websites/defining-website-content-structure/managing-custom-tables.md).
- **/bizformitem.bizform./** - deletes the data record the specified identifier (ID or GUID value) from the given [form](https://docs.kentico.com/13/managing-website-content/forms.md).

URL examples:

- \~/rest/cms.user/53
- \~/rest/cms.country/usa
- \~/rest/cms.emailtemplate/site/samplesite/Blog.NotificationToModerators
- \~/rest/customtableitem.customtable.SampleTable/5

Deleting multiple objects in a single request is not supported. You need to send a separate DELETE request for each object.
