0
Clone values list
One script reply has been approved by the moderators Verified

Clone all keyword groups of the current project to another one. This endpoint is a little more general (for further use). That's why you will see a 'type' field (with a default value of: 'keywords').

Created by hugo697 37 days ago Viewed 4 times
0
Submitted by hugo697 Bun
Verified 37 days ago
1
//native
2
type Botify = {
3
	token: string
4
}
5
/**
6
 * Clone values list
7
 * Clone all keyword groups of the current project to another one.  This endpoint is a little more general (for further use). That's why you will see a 'type' field (with a default value of: 'keywords').
8
 */
9
export async function main(auth: Botify, username: string, project_slug: string) {
10
	const url = new URL(
11
		`https://api.botify.com/projects/${username}/${project_slug}/values_list/clone`
12
	)
13

14
	const response = await fetch(url, {
15
		method: 'POST',
16
		headers: {
17
			Authorization: 'Token ' + auth.token
18
		},
19
		body: undefined
20
	})
21
	if (!response.ok) {
22
		const text = await response.text()
23
		throw new Error(`${response.status} ${text}`)
24
	}
25
	return await response.text()
26
}
27