0
Creates a new Vault Entry.
One script reply has been approved by the moderators Verified
Created by hugo697 16 days ago Viewed 0 times
0
Submitted by hugo697 Bun
Verified 16 days ago
1
//native
2
type Aero_workflow = {
3
	apiKey: string
4
}
5

6
export async function main(
7
	auth: Aero_workflow,
8
	accountid: string,
9
	companyId: string,
10
	body: {
11
		name: string
12
		type: string
13
		securityLevel: string
14
		link?: string
15
		userName?: string
16
		securedValue?: string
17
		description?: string
18
	}
19
) {
20
	const url = new URL(
21
		`https://api.aeroworkflow.com/api/${accountid}/v1/Companies/${companyId}/VaultEntries`
22
	)
23

24
	const response = await fetch(url, {
25
		method: 'POST',
26
		headers: {
27
			'Content-Type': 'application/json',
28
			apikey: auth.apiKey
29
		},
30
		body: JSON.stringify(body)
31
	})
32

33
	if (!response.ok) {
34
		const text = await response.text()
35
		throw new Error(`${response.status} ${text}`)
36
	}
37

38
	return await response.json()
39
}
40