Share via


st create

[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.]

Creates an authority, container or an entity.

st create <authorityid> [<containerid> [<entityid> <payload-file>]]
          <credentials> 
          [/REST | /SOAP]
          [/parallel:<number>] [/verbose]

When creating a container, you specify existing authority id and container id you want to create. When creating an entity, you specify existing authority id, and container id followed by entity id you want to create.

Examples

Example 1 Creating an authority

The following example creates myauth authority.

cmdPrompt>st create myauth /host:data.database.windows.net /user:userName 

You can execute the get command to verify the authority creation.

cmdPrompt>st get myauth /host:data.database.windows.net /user:userName 

This returns the authority metadata.

<s:Authority 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>myauth</s:Id>
  <s:Version>2023</s:Version>
</s:Authority>

Example 2 Creating a container

The following example creates a container. It specifies existing authority id (myauth) followed by the new container id.

cmdPrompt>st create myauth c1 /host:data.database.windows.net /user:userName 

This creates a container c1 in myauth authority. You can verify the container creation by executing the st get command.

cmdPrompt>st get myauth c1 /host:data.database.windows.net /user:userName              

The get command returns the container c1 metadata.

<s:Container 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>c1</s:Id>
  <s:Version>2025</s:Version>
</s:Container>

Example 3 Creating an entity

When creating an entity you specify the existing authority id (myauth) and container id (c1) followed by new entity id to create. For example,

cmdPrompt> st create myauth c1 e1 /host:data.database.windows.net /user:userName 

However, when creating an entity you must also specify the XML payload file describing the optional flexible properties. You have two options to specify this XML payload

  • Specify existing XML payload file name (with .xml extension).

    cmdPrompt>st create myauth c1 e1 MyEntityPayload.xml /host:data.database.windows.net /user:userName 
    
  • You may create the XML pay load file on the fly. Enter a '?' following the entity id in which case a Notepad document opens with a skeleton XML template. In this template you add any flexible properties you want for the new entity you are creating.

    cmdPrompt>st /host:data.database.windows.net /user:userName create myauth c1 e1 ?
    

The XML template is shown below:

   <?xml version="1.0"?>
<kind xmlns:s="https://schemas.microsoft.com/sitka/2008/03/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <s:Id>e1</s:Id>
  <!--<s xsi:type="xs:string">string</s>
  <n xsi:type="xs:decimal">1.234</n>
  <d xsi:type="xs:dateTime">2001-01-01T10:10:10.123Z</d>
  <b xsi:type="xs:boolean">true</b>
  <x xsi:type="xs:base64Binary">1a3=</x>-->
</kind>

After adding the entity properties, you save the document and close it. The st create command uses this file and creates the entity.

A sample XML payload with entity flexible properties FirstName and LastName is shown below.

<?xml version="1.0"?>
<kind xmlns:s="https://schemas.microsoft.com/sitka/2008/03/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <s:Id>e101</s:Id>
  <FirstName xsi:type="xs:string">SomeFirstName</FirstName>
  <LastName xsi:type="xs:string">SomeFirstName</LastName>
</kind>

You can execute the get command to verify the entity creation.

cmdPrompt>st /host:data.database.windows.net 
             /user:userName 
                          get myauth c1 e1

Example 4 Creating a blob entity

To create a blob entity you must specify the blob file name. The following example creates a blob entity (Id="blob1") from blob1.jpg file. The blob is created in container c1.

cmdPrompt>st create myauth c1 blob1 "blob1.jpg" /host:data.database.windows.net /user:userName 

You can verify the blob creation by executing a st get.

cmdPrompt>st get myauth c1 blob1 /host:data.database.windows.net /user:userName /accept:"application/x-ssds+xml" 

The command specifies /accept option value as "application/x-sdds+xml". Therefore, the command returns metadata for the blob entity as shown:

<s:Entity 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>blob1</s:Id>
  <s:Version>2022</s:Version>
  <s:Content content-type="image/jpeg" content-length="1723" 
             content-disposition="attachment; filename=blob1.jpg" />
</s:Entity>

If you want to retrieve the blob and not the metadata, you specify /accept value "image/jpeg" (or don't specify /accept option):

cmdPrompt>st get myauth c1 blob1 /host:data.database.windows.net /user:userName /accept:"image/jpeg"

The get command retrieves the blob and stores it in a file in the working folder. The file name is constructed using the file name value (blob1.jpg) in the content-disposition metadata of the entity. Instead of storing the blob retrieved to a file, you can specify /console to write the blob to the console window.

You can also verify the blob creation by specifying the blob entity URI in the browser. For example

https://myauth.data.database.windows.net/v1/c1/blob1

See Also

Concepts

SDS Command Line Tool