Asset Creation Examples
This endpoint was introduced in 18.0, Winter 2018. Please view the About VersionOne information from the orange help icon in the menu bar to see if you are on this release or later.
Note: Examples will be given in preview mode by including "previewOnly=true" query parameter. To commit the changes to VersionOne with these API examples, simply omit the "previewOnly=true" query parameter.
Create a Single Story
curl -i -X POST \
-H "Content-Type:application/json" \
-H "Authorization:Bearer 1.BO9wxGpDbI2Oh2OPbhb7wW4ghj0=" \
-d \
'{
"Scope": "System (All Projects)",
"AssetType": "Story",
"Name": "Story"
}' \
'https://yourVersionOneInstance/api/asset?previewOnly=true'
Create Multiple Stories
curl -i -X POST \
-H "Content-Type:application/json" \
-H "Authorization:Bearer 1.BO9wxGpDbI2Oh2OPbhb7wW4ghj0=" \
-d \
'[{
"Scope": "System (All Projects)",
"AssetType": "Story",
"Name": "Story A"
},
{
"Scope": "System (All Projects)",
"AssetType": "Story",
"Name": "Story B"
}
]' \
'https://yourVersionOneInstance/api/asset?previewOnly=true'
Create mulitple types of assets
curl -i -X POST \
-H "Content-Type:application/json" \
-H "Authorization:Bearer 1.BO9wxGpDbI2Oh2OPbhb7wW4ghj0=" \
-d \
'[{
"Scope": "System (All Projects)",
"AssetType": "Story",
"Name": "Story A"
},
{
"Scope": "System (All Projects)",
"AssetType": "Defect",
"Name": "Defect A"
}
]' \
'https://yourVersionOneInstance/api/asset?previewOnly=true'
Create multiple Stories and attach Tests and Tasks to each
curl -i -X POST \
-H "Content-Type:application/json" \
-H "Authorization:Bearer 1.BO9wxGpDbI2Oh2OPbhb7wW4ghj0=" \
-d \
'[
{
"Scope": "System (All Projects)",
"AssetType": "Story",
"Name": "Story-1",
"Children": [
{
"AssetType": "Test",
"Name": "Test-1 in Story-1"
},
{
"AssetType": "Task",
"Name": "Task-1 in Story-1"
},
{
"AssetType": "Test",
"Name": "Test-2 in Story-1"
},
{
"AssetType": "Task",
"Name": "Task-2 in Story-1"
}
]
},
{
"Scope": "System (All Projects)",
"AssetType": "Story",
"Name": "Story-2",
"Children": [
{
"AssetType": "Test",
"Name": "Test-1 in Story-2"
},
{
"AssetType": "Task",
"Name": "Task-1 in Story-2"
},
{
"AssetType": "Test",
"Name": "Test-2 in Story-2"
},
{
"AssetType": "Task",
"Name": "Task-2 in Story-2"
}
]
},
{
"Scope": "System (All Projects)",
"AssetType": "Story",
"Name": "Story-3",
"Children": [
{
"AssetType": "Test",
"Name": "Test-1 in Story-3"
},
{
"AssetType": "Task",
"Name": "Task-1 in Story-3"
},
{
"AssetType": "Test",
"Name": "Test-2 in Story-3"
},
{
"AssetType": "Task",
"Name": "Task-2 in Story-3"
}
]
}
]' \
'https://yourVersionOneInstance/api/asset?previewOnly=true'
Create Story and attach to existing Epic
curl -i -X POST \
-H "Content-Type:application/json" \
-H "Authorization:Bearer 1.BO9wxGpDbI2Oh2OPbhb7wW4ghj0=" \
-d \
'[{
"from" : "Epic:4622",
"update" : {
"Subs" : {
"add" :[ {
"AssetType" : "Story",
"Name" : "Story-1"
}]
}
}
}]' \
'https://yourVersionOneInstance/api/asset?previewOnly=true'
Create a new Story and use an existing Story then attach both to an Epic
curl -i -X POST \
-H "Content-Type:application/json" \
-H "Authorization:Bearer 1.BO9wxGpDbI2Oh2OPbhb7wW4ghj0=" \
-d \
'[{
"from" : "Epic:4622",
"update" : {
"Subs" : {
"add" :[
{
"AssetType" : "Story",
"Name" : "Story-1"
},
"Story:1234"
]
}
}
}]' \
'https://yourVersionOneInstance/api/asset?previewOnly=true'
Associate a Story to an Epic using a Subquery
curl -i -X POST \
-H "Content-Type:application/json" \
-H "Authorization:Bearer 1.BO9wxGpDbI2Oh2OPbhb7wW4ghj0=" \
-d \
'[{
"from" : "Epic:4622",
"update" : {
"Subs" : {
"add" : {
"from": "Story",
"filter" : ["ID='Story:1227'"]
}
}
}
}]' \
'https://yourVersionOneInstance/api/asset?previewOnly=true'