Batch create new Assets at /api/asset and /api/asset/{AssetType}

For creating Assets, it supports nested parent-child relationships, and it figures out automatically how to relate newly-created child Assets to their reciprocally related parent.

Quickstart: Create a single Story with a Task and Test at /api/asset/Story

This creates a new Story on the existing Scope:0 project and creates a child Task and Test asset as well:

curl -i -X POST \
   -H "Content-Type:application/json" \
   -H "Authorization:Basic YWRtaW46YWRtaW4=" \
   -d \
'{
  "Name": "My Story",
  "Scope": "Scope:0",
  "Description": "My story is awesome",
  "Children": [
    {
      "AssetType": "Test",
      "Name": "Test 1",
      "Description": "A test is always the first thing to think of"
    },
    {
      "AssetType": "Task",
      "Name": "Task 1",
      "Description": "But if you don\''t do the work, it never gets done"
    }
  ]
}' \
 'http://localhost/VersionOne.Web/api/asset/Story'

Here is the same example using YAML, which is easier to type and less error-prone:

 curl -i -X POST \
   -H "Content-Type:text/yaml" \
   -H "Authorization:Basic YWRtaW46YWRtaW4=" \
   -d \
'Name: My Story
Scope: Scope:0
Description: My story is awesome
Children:
- AssetType: Test
  Name: Test 1
  Description: A test is always the first thing to think of
- AssetType: Task
  Name: Task 1
  Description: But if you don\''t do the work, it never gets done' \
 'http://localhost/VersionOne.Web/api/asset/Story'

Note that we did not need to pass the AssetType: Story attribute, because it was implied by the sub-route path fragment.

Quickstart: Create three Story Assets at /api/asset

In the previous example, we posted to http://localhost/VersionOne.Web/api/asset/Story. Notice below in our example for creating three Story Assets, we just remove the AssetType from the URI:

curl -i -X POST \
   -H "Content-Type:application/json" \
   -H "Authorization:Basic YWRtaW46YWRtaW4=" \
   -d \
'[
  {
    "Name": "One Story",
    "Scope": "Scope:0"
  },
  {
    "Name": "Two Story",
    "Scope": "Scope:0"
  },
  {
    "Name": "Three Story",
    "Scope": "Scope:0"
  }
]' \
 'http://localhost/VersionOne.Web/api/asset/Story'

Note that for the same example in YAML, instead of an array, we use the --- document separator:

curl -i -X POST \
   -H "Content-Type:text/yaml" \
   -H "Authorization:Basic YWRtaW46YWRtaW4=" \
   -d \
'Name: One Story
Scope: Scope:0
---
Name: Two Story
Scope: Scope:0
---
Name: Three Story
Scope: Scope:0' \
 'http://localhost/VersionOne.Web/api/asset/Story'

results matching ""

    No results matching ""