MCPcopy Create free account
hub / github.com/apache/cloudstack / postAPI

Function postAPI

ui/src/api/index.js:57–78  ·  view source on GitHub ↗
(command, data = {})

Source from the content-addressed store, hash-verified

55}
56
57export function postAPI (command, data = {}) {
58 const params = new URLSearchParams()
59 params.append('command', command)
60 params.append('response', 'json')
61 if (data) {
62 Object.entries(data).forEach(([key, value]) => {
63 if (value !== undefined && value !== null) {
64 params.append(key, value)
65 }
66 })
67 }
68
69 const sessionkey = vueProps.$localStorage.get(ACCESS_TOKEN) || Cookies.get('sessionkey')
70 if (sessionkey) {
71 params.append('sessionkey', sessionkey)
72 }
73 return axios({
74 url: '/',
75 method: 'POST',
76 data: params
77 })
78}
79
80export function callAPI (command, args = {}) {
81 const isGetAPICommand = getAPICommandsRegex.test(command) || additionalGetAPICommandsList.includes(command.toLowerCase())

Callers 3

loginFunction · 0.85
logoutFunction · 0.85
oauthloginFunction · 0.85

Calls 2

getMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected