Creating an Entity Using REST

[This document supports a preliminary release of a software product that may be changed substantially prior to final commercial release. This document is provided for informational purposes only.]

To create an entity by using the REST interface, you define an XML payload that describes the entity you want to create (including the required Id metadata property) as shown in the following example. The XML payload in this example describes a book entity.

<Book xmlns:s='https://schemas.microsoft.com/sitka/2008/03/'
      xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
      xmlns:x='http://www.w3.org/2001/XMLSchema' >
      <s:Id>MyBookId</s:Id> 
      <title xsi:type='x:string'>Some Title</title>
      <summary xsi:type='x:string'>Some Summary</summary> 
      <isbn xsi:type='x:string'>11-1111-11-1</isbn> 
      <author xsi:type='x:string'>Mr. Author</author> 
      <publisher xsi:type='x:string'>Mr. Publisher</publisher> 
 </Book>

Note

The entity id must be unique within the specified container.

After the payload has been defined, you send an HTTP request to the service by using the POST method on the request. This action sends the payload to the service. After you have completed the operation, the service returns a response with an HTTP status that indicates whether the operation succeeded or failed. The following topics provide working examples in various programming languages.

Creating an Entity Using REST (C#)

Creating an Entity Using REST (Java)

Creating an Entity Using REST (Ruby)

Creating an Entity Using REST (VB)

See Also

Concepts

Getting Ready to Use SQL Data Services
SDS Data Model Overview (Authorities, Containers, Entities and Flexible Entities)
Creating an Entity Using SOAP
Examples of Using SOAP and REST Interfaces with the SQL Data Services