CreateTicket

API Request

URLs
POST zstack/v1/tickets
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "this is a new ticket",
    "requests": [
      {
        "requestName": "create vm",
        "apiName": "org.zstack.header.vm.APICreateVmInstanceMsg",
        "executeTimes": 1.0,
        "apiBody": {
          "name": "vm name",
          "instanceOfferingUuid": "46466abc6c8931fdaab7a8df43e4f175",
          "imageUuid": "43e997234af63863b28a5e9987e1d122",
          "l3NetworkUuids": [
            "8b4ddd66c7ba30598cdc7ab835e04f96"
          ],
          "strategy": "InstantStart",
          "timeout": -1.0,
          "headers": {},
          "id": "a9a029dba17842939f0227420d197121",
          "createdTime": 1.545993580705E12
        }
      }
    ],
    "accountSystemType": "iam2",
    "accountSystemContext": {
      "projectUuid": "28c9a199e3e842d28c9805eb89be56cb",
      "virtualIDUuid": "1c255722caf34cb888b57d11a744248c"
    }
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"this is a new ticket","requests":[{"requestName":"create vm","apiName":"org.zstack.header.vm.APICreateVmInstanceMsg","executeTimes":1.0,"apiBody":{"name":"vm name","instanceOfferingUuid":"46466abc6c8931fdaab7a8df43e4f175","imageUuid":"43e997234af63863b28a5e9987e1d122","l3NetworkUuids":["8b4ddd66c7ba30598cdc7ab835e04f96"],"strategy":"InstantStart","timeout":-1.0,"headers":{},"id":"590ee3ceb92248e08967bf413de91e26","createdTime":1.545993580708E12}}],"accountSystemType":"iam2","accountSystemContext":{"projectUuid":"a497d61cc2d848f2a1101ebd7bc7362f","virtualIDUuid":"c0df7a66330f4cc3b83d1c3695aac291"}}}' http://localhost:8080/zstack/v1/tickets
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 3.0.0
description String body (contained in the params structure) Optional. The detailed description of the resource. 3.0.0
requests List body (contained in the params structure) 3.0.0
flowCollectionUuid String body (contained in the params structure) Optional. 3.0.0
accountSystemType String body (contained in the params structure) 3.0.0
accountSystemContext Object body (contained in the params structure) 3.0.0
resourceUuid String body (contained in the params structure) Optional. 3.0.0
systemTags List body Optional. 3.0.0
userTags List body Optional. 3.0.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK
CreateTicketAction action = new CreateTicketAction();
action.name = "this is a new ticket";
action.requests = asList([requestName:create vm, apiName:org.zstack.header.vm.APICreateVmInstanceMsg, executeTimes:1.0, apiBody:[name:vm name, instanceOfferingUuid:46466abc6c8931fdaab7a8df43e4f175, imageUuid:43e997234af63863b28a5e9987e1d122, l3NetworkUuids:[8b4ddd66c7ba30598cdc7ab835e04f96], strategy:InstantStart, timeout:-1.0, headers:[:], id:0132535043b04abf9f56eb9a1fb4c87b, createdTime:1.545993580749E12]]);
action.accountSystemType = "iam2";
action.accountSystemContext = [projectUuid:01ce66b048c5477195b5d6e43507239c, virtualIDUuid:cd120a6130884e4ca80a01b10e59de86];
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateTicketAction.Result res = action.call();
Python SDK
CreateTicketAction action = CreateTicketAction()
action.name = "this is a new ticket"
action.requests = [[requestName:create vm, apiName:org.zstack.header.vm.APICreateVmInstanceMsg, executeTimes:1.0, apiBody:[name:vm name, instanceOfferingUuid:46466abc6c8931fdaab7a8df43e4f175, imageUuid:43e997234af63863b28a5e9987e1d122, l3NetworkUuids:[8b4ddd66c7ba30598cdc7ab835e04f96], strategy:InstantStart, timeout:-1.0, headers:[:], id:379419159124407c903a2b3f13ca6f96, createdTime:1.54599358075E12]]]
action.accountSystemType = "iam2"
action.accountSystemContext = [projectUuid:629c222d0b834ec3aa3af9f5a0e5d986, virtualIDUuid:bf3198f5680341ac88f54d59e94ad7ab]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateTicketAction.Result res = action.call()