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()

UpdateTicketRequest

API Request

URLs
PUT zstack/v1/tickets/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{   "updateTicketRequest": {     "requests": [       {         "requestName": "create vm",         "apiName": "org.zstack.header.vm.APICreateVmInstanceMsg",         "executeTimes": 1.0,         "apiBody": {           "name": "vm name",           "instanceOfferingUuid": "dba186c0f4e73c8b853e36b37a028761",           "imageUuid": "a3688b0adaaf3745b9919d6bcbf374b1",           "l3NetworkUuids": [             "cc68b29962063148a2b5434d434f1f90"           ],           "strategy": "InstantStart",           "timeout": -1.0,           "headers": {},           "id": "779c0969ca40422a9f371710c245e271",           "createdTime": 1.564025557712E12         }       }     ]   },   "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 PUT -d '{"updateTicketRequest":{"requests":[{"requestName":"create vm","apiName":"org.zstack.header.vm.APICreateVmInstanceMsg","executeTimes":1.0,"apiBody":{"name":"vm name","instanceOfferingUuid":"dba186c0f4e73c8b853e36b37a028761","imageUuid":"a3688b0adaaf3745b9919d6bcbf374b1","l3NetworkUuids":["cc68b29962063148a2b5434d434f1f90"],"strategy":"InstantStart","timeout":-1.0,"headers":{},"id":"151dc242428a4b39a81a9b31712e7f09","createdTime":1.564025557718E12}}]}}' http://localhost:8080/zstack/v1/tickets/3d7955e800593abcb49e89c372d6a5ce/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.0.0
requests List body (contained in the updateTicketRequest structure) 3.0.0
systemTags List body Optional. 3.0.0
userTags List body Optional. 3.0.0

API Response

Sample Response
{   "inventory": {     "uuid": "14b4cced263d4e0b8511292980c7984f",     "name": "ticket",     "description": "ticket description",     "status": "IntermediateApproved",     "request": [       {         "requestName": "create vm",         "apiName": "org.zstack.header.vm.APICreateVmInstanceMsg",         "executeTimes": 1.0,         "apiBody": {           "name": "vm name",           "instanceOfferingUuid": "c14ffce45a924c7c89b29b472b0cc6a5",           "imageUuid": "21bc6910199d44b3bbd0e336bb88f424",           "l3NetworkUuids": [             "ff4916c36d9a4c1683c20e5a22ceceb7"           ],           "strategy": "InstantStart",           "timeout": -1.0,           "headers": {},           "id": "bde85ab4eb754339bc6bb42623097c56",           "createdTime": 1.564025557751E12         }       }     ],     "accountSystemType": "iam2",     "ticketTypeUuid": "3b933e9aaf2d49b9a3dcf0c92867790f",     "accountSystemContext": {       "projectUuid": "2294a0edf109447bafa802bb73b29cd3",       "virtualIDUuid": "178c834b9bc84bac9e77460b42eb3494"     },     "flowCollectionUuid": "9fbbac8054d54f0490438eaaba3e1cf8"   } }
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.0.0
inventory TicketInventory See inventory. 3.0.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.0.0
description String The brief description of the error. 3.0.0
details String The details about the error. 3.0.0
elaboration String The reserved field. Default value: null. 3.0.0
opaque LinkedHashMap The reserved field. Default value: null. 3.0.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.0.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.0.0
name String The resource name. 3.0.0
description String The detailed description of the resource. 3.0.0
accountSystemType String 3.0.0
ticketTypeUuid String The ticket type UUID. 3.6.0
accountSystemContext Object 3.0.0
currentFlowUuid String 3.0.0
flowCollectionUuid String 3.0.0
createDate Timestamp The creation date. 3.0.0
lastOpDate Timestamp The last operation date. 3.0.0
status TicketStatus See status. 3.0.0
request List See request. 3.0.0
#status
Name Type Description Starting Version
name String The resource name. 3.0.0
ordinal int 3.0.0
#request
Name Type Description Starting Version
requestName String 3.0.0
apiName String 3.0.0
executeTimes int 3.0.0
apiBody Object 3.0.0

SDK Sample

Java SDK
UpdateTicketRequestAction action = new UpdateTicketRequestAction(); action.uuid = "3d7955e800593abcb49e89c372d6a5ce"; action.requests = asList([requestName:create vm, apiName:org.zstack.header.vm.APICreateVmInstanceMsg, executeTimes:1.0, apiBody:[name:vm name, instanceOfferingUuid:dba186c0f4e73c8b853e36b37a028761, imageUuid:a3688b0adaaf3745b9919d6bcbf374b1, l3NetworkUuids:[cc68b29962063148a2b5434d434f1f90], strategy:InstantStart, timeout:-1.0, headers:[:], id:ac92123f5b9144159389b4d3d5e95fcf, createdTime:1.564025557873E12]]); action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; UpdateTicketRequestAction.Result res = action.call();
Python SDK
UpdateTicketRequestAction action = UpdateTicketRequestAction() action.uuid = "3d7955e800593abcb49e89c372d6a5ce" action.requests = [[requestName:create vm, apiName:org.zstack.header.vm.APICreateVmInstanceMsg, executeTimes:1.0, apiBody:[name:vm name, instanceOfferingUuid:dba186c0f4e73c8b853e36b37a028761, imageUuid:a3688b0adaaf3745b9919d6bcbf374b1, l3NetworkUuids:[cc68b29962063148a2b5434d434f1f90], strategy:InstantStart, timeout:-1.0, headers:[:], id:2be0f869588b4051907cd550a9913683, createdTime:1.564025557879E12]]] action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" UpdateTicketRequestAction.Result res = action.call()

ChangeTicketStatus

API Request

URLs
PUT zstack/v1/tickets/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{   "changeTicketStatus": {     "statusEvent": "approve",     "comment": "this is the comment for change status operation"   },   "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 PUT -d '{"changeTicketStatus":{"statusEvent":"approve","comment":"this is the comment for change status operation"}}' http://localhost:8080/zstack/v1/tickets/e9377476db3f375bbff78dc3b9204f00/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.0.0
statusEvent TicketStatusEvent body (contained in the changeTicketStatus structure)
  • open
  • approve
  • cancel
  • reject
  • reopen
3.0.0
comment String body (contained in the changeTicketStatus structure) Optional. 3.0.0
systemTags List body Optional. 3.0.0
userTags List body Optional. 3.0.0

API Response

Sample Response
{   "inventory": {     "uuid": "f4483251fdfd48cdae0dbb966a2652c9",     "name": "ticket",     "description": "ticket description",     "status": "IntermediateApproved",     "request": [       {         "requestName": "create vm",         "apiName": "org.zstack.header.vm.APICreateVmInstanceMsg",         "executeTimes": 1.0,         "apiBody": {           "name": "vm name",           "instanceOfferingUuid": "e539401d4cf74a6c93b173b9fa01d4e6",           "imageUuid": "16e0a61a2ca145eaaae6c7e9ef72ae31",           "l3NetworkUuids": [             "0fbf9d6545e6480790ee9b2f7da59f65"           ],           "strategy": "InstantStart",           "timeout": -1.0,           "headers": {},           "id": "3f1b84f2f3ca453caf3086625d57eff5",           "createdTime": 1.56402555717E12         }       }     ],     "accountSystemType": "iam2",     "ticketTypeUuid": "3b933e9aaf2d49b9a3dcf0c92867790f",     "accountSystemContext": {       "projectUuid": "21423d5537cc4891b33745b3ad9045f8",       "virtualIDUuid": "1470a380fe454b4298ba178245aa499c"     },     "flowCollectionUuid": "6aa051e47de74658885bca987b9c4a35"   } }
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.0.0
inventory TicketInventory See inventory. 3.0.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.0.0
description String The brief description of the error. 3.0.0
details String The details about the error. 3.0.0
elaboration String The reserved field. Default value: null. 3.0.0
opaque LinkedHashMap The reserved field. Default value: null. 3.0.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.0.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.0.0
name String The resource name. 3.0.0
description String The detailed description of the resource. 3.0.0
accountSystemType String 3.0.0
ticketTypeUuid String The ticket type UUID. 3.6.0
accountSystemContext Object 3.0.0
currentFlowUuid String 3.0.0
flowCollectionUuid String 3.0.0
createDate Timestamp The creation date. 3.0.0
lastOpDate Timestamp The last operation date. 3.0.0
status TicketStatus See status. 3.0.0
request List See request. 3.0.0
#status
Name Type Description Starting Version
name String The resource name. 3.0.0
ordinal int 3.0.0
#request
Name Type Description Starting Version
requestName String 3.0.0
apiName String 3.0.0
executeTimes int 3.0.0
apiBody Object 3.0.0

SDK Sample

Java SDK
ChangeTicketStatusAction action = new ChangeTicketStatusAction(); action.uuid = "e9377476db3f375bbff78dc3b9204f00"; action.statusEvent = "approve"; action.comment = "this is the comment for change status operation"; action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; ChangeTicketStatusAction.Result res = action.call();
Python SDK
ChangeTicketStatusAction action = ChangeTicketStatusAction() action.uuid = "e9377476db3f375bbff78dc3b9204f00" action.statusEvent = "approve" action.comment = "this is the comment for change status operation" action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" ChangeTicketStatusAction.Result res = action.call()















Back to Top

Download

Already filled the basic info?Click here.

Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.

Email Us

contact@zstack.io
ZStack Training and Certification
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io
Request Trial
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for using ZStack products and services.