Cheatsheet
Create assets of a single type
Using cURL for these examples
We're big fans of cURL at VersionOne. In all of these cheetsheat examples, you can use the following cURL template. Just replace the TYPE
and PAYLOAD
placeholders with the type and payload from the example and you're ready to roll.
cURL template
curl http://localhost/VersionOne.Web/api/asset/TYPE \
-i -X POST \
-H "Content-Type:text/yaml" \
-H "Authorization:Basic YWRtaW46YWRtaW4=" \
-d \
'PAYLOAD'
Create a single new Asset of type Story
Type
Story
Payload
Name: Hello world!
Scope: Scope:0
Complete example
curl http://localhost/VersionOne.Web/api/asset/Story \
-i -X POST \
-H "Content-Type:text/yaml" \
-H "Authorization:Basic YWRtaW46YWRtaW4=" \
-d \
'Name: Hello world!
Scope: Scope:0'
Result example
You should see a result like this:
{
"requestId": "11ba0b1f-003f-43e8-a9ee-31859b2320de",
"createdDate": "2017-04-07T19:43:38.8070207Z",
"completedDate": "2017-04-07T19:43:39.0113065Z",
"duration": "00:00:00.2042858",
"durationSeconds": 0.2042858,
"complete": true,
"processing": false,
"assetsCreated": {
"oidTokens": [
"Story:85568"
],
"count": 1
},
"assetsModified": {
"oidTokens": [],
"count": -1
},
"assetsOperatedOn": {
"oidTokens": [],
"count": -1
},
"queryResult": {
"results": [],
"count": -1
}
}
Create multiple new Assets of type Story
Type
Story
Payload
Name: Hello world!
Scope: Scope:0
---
Name: Hello again, world!
Scope: Scope:0
---
Name: Hello yet again.
Scope: Scope:0
Create a new Asset of type Story with child Task and Tests
Type
Story
Payload
Name: I have children
Children:
- AssetType: Task
Name: Child task
- AssetType: Test
Name: Child test
Note
Your result will have assetsCreated.count
= 1
, but that's just because it created one top-level Asset. You can verify that it worked by POSTing a query, asking for all children. Note here that we do not use /Story
in the URL. You'll have to modify the Story:85569
, of course:
curl http://localhost/VersionOne.Web/api/asset \
-i -X POST \
-H "Content-Type:text/yaml" \
-H "Authorization:Basic YWRtaW46YWRtaW4=" \
-d \
'from: Story
where:
ID: Story:85569
select:
- Name
- from: Children
select:
- AssetType
- Name'
Result
{
"requestId": "0f5df67c-c610-414b-875f-d37cf3c76a01",
"createdDate": "2017-04-07T19:51:18.7640573Z",
"completedDate": "2017-04-07T19:51:18.9825543Z",
"duration": "00:00:00.2184970",
"durationSeconds": 0.218497,
"complete": true,
"processing": false,
"assetsCreated": {
"oidTokens": [],
"count": 0
},
"assetsModified": {
"oidTokens": [],
"count": 0
},
"assetsOperatedOn": {
"oidTokens": [],
"count": 0
},
"queryResult": {
"results": [
[
{
"_oid": "Story:85569",
"Name": "I have children",
"Children": [
{
"_oid": "Task:85570",
"AssetType": "Task",
"Name": "Child task"
},
{
"_oid": "Test:85571",
"AssetType": "Test",
"Name": "Child test"
}
]
}
]
],
"count": 1
}
}
Create two new Epic Assets, each with Stories with child Task and Tests
Type
Epic
Payload
Name: I am Epic
Scope: Scope:0
Subs:
- AssetType: Story
Name: Story 1
Children:
- AssetType: Task
Name: Child task 1
- AssetType: Test
Name: Child test 1
---
Name: I am Epic 2
Scope: Scope:0
Subs:
- AssetType: Story
Name: Story 2
Children:
- AssetType: Task
Name: Child task 2
- AssetType: Test
Name: Child test 2