Scripts API

Contents

/scripts 

Description

Creates a script.

URL structure

httpsː//smart.cloud.com/v0/scripts?access_token=<valid token generated by authentication>

URL example

httpsː//smart.cloud.com/v0/scripts?access_token=VUHlewcsthNeVca7Fb5zR5oKC 

Method

POST

Parameters

JSON payload 

Sample payload: {"scriptName":"Test script","scriptType":"bat","scriptDescription":"", "scriptInputParams":[],"tagList":[],"scriptAttachments":[],"scriptContent":"bGluZTEKbGluZTIKbGluZTMKbGluZTQKbGluZTUKZWNobyAnSGknCg=="}

Where:

  • scriptContent field must be in Base64 encoding format (https://www.base64decode.org/)
  • scriptContent, scriptType, and scriptName are mandatory fields

Response

JSON payload

Sample response:

{  
   "scriptName":"Test script",
   "parentScriptId":0,
   "scriptType":"bat",
   "status":"ENABLED",
   "scriptInputParams":[  

   ],
   "sharedFlag":"N",
   "scriptAttachments":[  

   ],
   "version":"1",
   "scriptLocation":"40042/10093/1339350930277/",
   "internalToTemplate":"N",
   "parentCompanyId":0,
   "purchasedFlag":"N",
   "role":"Admin",
   "companyId":40042,
   "scriptId":"2446",
   "tagList":[  

   ],
   "user":"10093",
   "scriptContent":"bGluZTEKbGluZTIKbGluZTMKbGluZTQKbGluZTUKZWNobyAnSGknCg==",
   "viewableFlag":"Y"
}           

Back to top

/scripts/{id} 

Description

Updates a script.

URL structure

httpsː//smart.cloud.com/v0/scripts/id?access_token=<valid token generated by authentication>

URL example

httpsː//smart.cloud.com/v0/scripts/89145?access_token=VUHlewcsthNeVca7Fb5zR5oKC

Method

POST

Parameters

JSON payload

Sample payload:  {"scriptName":"Update script","scriptType":"bat","scriptDescription":"", "scriptInputParams":[],"tagList":[],"scriptAttachments":[],"scriptContent":"bGluZTEKbGluZTIKbGluZTMKbGluZTQKbGluZTUKZWNobyAnSGknCg==","version":"1"}

Where:

  • scriptContent field must be in Base64 encoding format (https://www.base64decode.org/)
  • scriptContent, scriptType, and scriptName are mandatory fields

Response

JSON payload

Sample response:

{  
   "scriptName":"Update script",
   "parentScriptId":0,
   "scriptType":"bat",
   "status":"ENABLED",
   "scriptInputParams":[  

   ],
   "sharedFlag":"N",
   "scriptAttachments":[  

   ],
   "version":"1",
   "scriptLocation":"40042/10093/1339350930277/",
   "internalToTemplate":"N",
   "parentCompanyId":0,
   "purchasedFlag":"N",
   "role":"Admin",
   "companyId":40042,
   "scriptId":"2446",
   "tagList":[  

   ],
   "user":"10093",
   "scriptContent":"bGluZTEKbGluZTIKbGluZTMKbGluZTQKbGluZTUKZWNobyAnSGknCg==",
   "viewableFlag":"Y"
}         

Back to top

/scripts 

Description

Gets a list of all scripts. By default, provides a list of  all scripts with latest versions.

URL structure

httpsː//smart.cloud.com/v0/scripts?access_token=<valid access token>

URL example

httpsː//smart.cloud.com/v0/scripts?access_token=VUHlewcsthNeVca7Fb5zR5oKC

Method

GET

Parameters

version (optional) parameter

Response

Sample response:

 {  
   "companyId":40034,
   "role":"Admin",
   "user":"10087",
   "extraAttrs":{  

   },
   "scriptId":"15280",
   "scriptName":"0000000000",
   "version":"7",
   "scriptDescription":"VmVyc2lvbiA1YWRzZjM0MzM0MzQzYXMzM2Fkc2Y=",
   "scriptInputParams":[  

   ],
   "scriptAttachments":[  

   ],
   "tagList":[  
      {  
         "companyId":0,
         "extraAttrs":{  

         },
         "tagName":"no",
         "tagType":"USER_DEFINED"
      },
      {  
         "companyId":0,
         "extraAttrs":{  

         },
         "tagName":"hi",
         "tagType":"USER_DEFINED"
      },
      {  
         "companyId":0,
         "extraAttrs":{  

         },
         "tagName":"hi",
         "tagType":"INTERNAL"
      }
   ],
   "metadata":{  

   },
   "sku":{  

   },
   "parentScriptId":0,
   "parentCompanyId":0,
   "shared":"Y",
   "useNamedParameters":"N"
},
{  
   "companyId":40034,
   "role":"Admin",
   "user":"10087",
   "extraAttrs":{  

   },
   "scriptId":"21191",
   "scriptName":"00-4skin add script",
   "version":"1",
   "scriptDescription":"YXNkZg==",
   "scriptInputParams":[  

   ],
   "scriptAttachments":[  

   ],
   "tagList":[  
      {  
         "companyId":0,
         "extraAttrs":{  

         },
         "tagName":"sd",
         "tagType":"USER_DEFINED"
      }
   ],
   "metadata":{  

   },
   "sku":{  

   },
   "parentScriptId":0,
   "parentCompanyId":0,
   "shared":"N",
   "useNamedParameters":"N"
},

Back to top

/scripts/{id} 

Description

Gets details of a single script. By default, provides details of the latest version of the script.

URL structure

httpsː//smart.cloud.com/v0/scripts/id?access_token=<valid access token>

URL example

httpsː//smart.cloud.com/v0/scripts/89145?access_token=VUHlewcsthNeVca7Fb5zR5oKC

Method

GET

Parameters

version (optional) parameter

Response

Sample response:

{  
   "companyId":40034,
   "role":"Admin",
   "user":"10087",
   "extraAttrs":{  

   },
   "scriptId":"22889",
   "scriptName":"DeleteScript1430124199973",
   "version":"2",
   "scriptType":"bat",
   "scriptPlatform":"",
   "scriptTags":"",
   "scriptDescription":"",
   "scriptContent":"ZWNobyAiaGVsbG8i",
   "inputParams":"",
   "scriptInputParams":[  

   ],
   "scriptAttachments":[  

   ],
   "tagList":[  

   ],
   "metadata":{  

   },
   "status":"ENABLED",
   "sku":{  

   },
   "scriptLocation":"40034/10087/1430124199787/",
   "viewableFlag":"Y",
   "parentScriptId":0,
   "parentCompanyId":0,
   "purchasedFlag":"",
   "sharedFlag":"",
   "internalToTemplate":"N",
   "type":"SCRIPT",
   "subType":"",
   "shared":"N",
   "useNamedParameters":"N"
}

Back to top

/scripts/{id}/versions 

Description

Gets a list of versions of a script associated with a provided id

URL structure

httpsː//smart.cloud.com/v0/scripts/<id>/versions?access_token=<valid access token>

URL example

httpsː//smart.cloud.com/v0/scripts/89145/versions?access_token=VUHlewcsthNeVca7Fb5zR5oKC

Method

GET

Parameters

None

Response

JSON payload

Sample response:

{  
   "companyId":10000,
   "role":"Admin",
   "user":"10000",
   "extraAttrs":{  

   },
   "scriptId":"17",
   "scriptName":"New Design",
   "version":"2",
   "scriptInputParams":[  

   ],
   "scriptAttachments":[  

   ],
   "tagList":[  

   ],
   "metadata":{  

   },
   "sku":{  

   },
   "parentScriptId":0,
   "parentCompanyId":0,
   "shared":"N"
},
{  
   "companyId":10000,
   "role":"Admin",
   "user":"10000",
   "extraAttrs":{  

   },
   "scriptId":"17",
   "scriptName":"New Design",
   "version":"1",
   "scriptInputParams":[  

   ],
   "scriptAttachments":[  

   ],
   "tagList":[  

   ],
   "metadata":{  

   },
   "sku":{  

   },
   "parentScriptId":0,
   "parentCompanyId":0,
   "shared":"N"
}

Back to top

/scripts/{id} 

Description

Deletes a script associated with a provided id

URL structure

httpsː//smart.cloud.com/v0/scripts/<id>?access_token=<valid access token>

URL example

httpsː//smart.cloud.com/v0/scripts/1?access_token=VUHlewcsthNeVca7Fb5zR5oKC

Method

DELETE

Parameters

None

Response

JSON payload

Sample response:

{  
   "companyId":10000,
   "role":"Admin",
   "user":"10000",
   "extraAttrs":{  

   },
   "scriptId":"1",
   "scriptInputParams":[  
      0
   ],
   "scriptAttachments":[  
      0
   ],
   "tagList":[  
      0
   ],
   "metadata":{  

   },
   "sku":{  

   },
   "parentScriptId":0,
   "parentCompanyId":0,
   "shared":"N"
}

Back to top

/scripts/attachment 

Description

Creates a script with single or multiple file attachments.

URL structure

httpsː //smart.cloud.com/v0/scripts/attachment?access_token=<valid token generated by authentication>

URL example

httpsː //smart.cloud.com/v0/scripts/attachment?access_token=GXPibX1uHHlDbRpW6KWNItLdq

Method

POST

Content-Type: multipart/form-data

Parameters

  • payload (required): JSON payload
  • file (optional): array of files or file list

Sample payload:  {"scriptName":"Update script","scriptType":"bat","scriptDescription":"", "scriptInputParams":[],"tagList":[],"scriptAttachments":[],"scriptContent":"bGluZTEKbGluZTIKbGluZTMKbGluZTQKbGluZTUKZWNobyAnSGknCg==","version":"1"}          

Response

Sample response:


{  
   "companyId":10200,
   "role":"Admin",
   "user":"10144",
   "extraAttrs":{  

   },
   "scriptId":"92169",
   "scriptName":"TestAttachment",
   "version":"1",
   "scriptType":"sh",
   "scriptPlatform":"",
   "scriptTags":"[]",
   "scriptDescription":"",
   "scriptContent":"ZWNobyAiaGVlbG8i",
   "inputParams":"",
   "scriptInputParams":[  

   ],
   "scriptAttachments":[  
      {  
         "fileName":"timings",
         "location":"10200/10144/timings",
         "size":359
      }
   ],
   "tagList":[  

   ],
   "metadata":{  

   },
   "status":"ENABLED",
   "sku":{  

   },
   "scriptLocation":"10200/10144/3550566408077902/",
   "viewableFlag":"Y",
   "parentScriptId":0,
   "parentCompanyId":0,
   "purchasedFlag":"N",
   "sharedFlag":"N",
   "internalToTemplate":"N",
   "type":"SCRIPT",
   "subType":"",
   "shared":"N",
   "useNamedParameters":"N",
   "patchXDFlag":"N"
}

Back to top

/scripts/{id}/attachment 

Description

Updates an existing script with single or multiple file attachments.

URL structure

httpsː//smart.cloud.com/v0/scripts/{id}/attachment?access_token=<valid token generated by authentication>

URL example

httpsː//smart.cloud.com/v0/scripts/1020/attachment?access_token=GXPibX1uHHlDbRpW6KWNItLdq

Method

POST

Content-Type: multipart/form-data

Parameters

  • payload (required): JSON payload
  • file (optional): array of files or file list

Sample payload: 

{"companyId":39120,"role":"Admin","user":"10144","extraAttrs":{},"scriptName":"TestAttachment","version":"1","scriptType":"sh","scriptPlatform":"","scriptTags":"[]","scriptDescription":"","scriptContent":"ZWNobyAiaGVlbG8i","inputParams":"","scriptInputParams":[],"scriptAttachments":[{"fileName":"timings","location":"attachments/timings","size":359}],"tagList":[],"metadata":{},"status":"ENABLED","sku":{},"viewableFlag":"Y","parentScriptId":0,"parentCompanyId":0,"purchasedFlag":"N","sharedFlag":"N","internalToTemplate":"N","type":"SCRIPT","subType":"","shared":"N","useNamedParameters":"N","patchXDFlag":"N”}

Response

Sample response:


{  
   "companyId":10200,
   "role":"Admin",
   "user":"10144",
   "extraAttrs":{  

   },
   "scriptId":"92169",
   "scriptName":"TestAttachment",
   "version":"1",
   "scriptType":"sh",
   "scriptPlatform":"",
   "scriptTags":"[]",
   "scriptDescription":"",
   "scriptContent":"ZWNobyAiaGVlbG8i",
   "inputParams":"",
   "scriptInputParams":[  

   ],
   "scriptAttachments":[  
      {  
         "fileName":"timings",
         "location":"10200/10144/timings",
         "size":359
      }
   ],
   "tagList":[  

   ],
   "metadata":{  

   },
   "status":"ENABLED",
   "sku":{  

   },
   "scriptLocation":"10200/10144/3550566408077902/",
   "viewableFlag":"Y",
   "parentScriptId":0,
   "parentCompanyId":0,
   "purchasedFlag":"N",
   "sharedFlag":"N",
   "internalToTemplate":"N",
   "type":"SCRIPT",
   "subType":"",
   "shared":"N",
   "useNamedParameters":"N",
   "patchXDFlag":"N"
}

 

Back to top

/scripts/attachment 

Description

Gets the content of a script attachment file.

URL structure

httpsː//smart.cloud.com/v0/scripts/attachment?scriptid=<valid script id>&version=<script version>&filename=<file name of the attachment>&access_token=<valid token generated by authentication>

URL example: httpsː//smart.cloud.com/v0/scripts/attachment?scriptid=21762&version=1&filename=7z920.exe&access_token=GXPibX1uHHlDbRpW6KWNItLdq

Method

GET

Accept: application/octet-stream

Parameters

  • scriptid (required): ID of the script
  • version (required): Version of the script
  • filename (required): File name of the attachment

Response

Content of the attachment file in byte array format.

Back to top 

0 Comments