JavaScript
import Hyperspell from '@hyperspell/hyperspell';
const client = new Hyperspell({
apiKey: process.env['HYPERSPELL_API_KEY'], // This is the default and can be omitted
});
const response = await client.folders.setPolicies('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
provider_folder_id: 'provider_folder_id',
sync_mode: 'sync',
});
console.log(response.id);import os
from hyperspell import Hyperspell
client = Hyperspell(
api_key=os.environ.get("HYPERSPELL_API_KEY"), # This is the default and can be omitted
)
response = client.folders.set_policies(
connection_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
provider_folder_id="provider_folder_id",
sync_mode="sync",
)
print(response.id)package main
import (
"context"
"fmt"
"github.com/hyperspell/hyperspell-go"
"github.com/hyperspell/hyperspell-go/option"
)
func main() {
client := hyperspell.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Folders.SetPolicies(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
hyperspell.FolderSetPoliciesParams{
ProviderFolderID: "provider_folder_id",
SyncMode: hyperspell.FolderSetPoliciesParamsSyncModeSync,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.ID)
}
hyperspell folders set-policies \
--api-key 'My API Key' \
--connection-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \
--provider-folder-id provider_folder_id \
--sync-mode synccurl --request POST \
--url https://api.hyperspell.com/connections/{connection_id}/folder-policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider_folder_id": "<string>",
"folder_name": "<string>",
"folder_path": "<string>",
"parent_folder_id": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperspell.com/connections/{connection_id}/folder-policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider_folder_id' => '<string>',
'folder_name' => '<string>',
'folder_path' => '<string>',
'parent_folder_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.hyperspell.com/connections/{connection_id}/folder-policies")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider_folder_id\": \"<string>\",\n \"folder_name\": \"<string>\",\n \"folder_path\": \"<string>\",\n \"parent_folder_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperspell.com/connections/{connection_id}/folder-policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider_folder_id\": \"<string>\",\n \"folder_name\": \"<string>\",\n \"folder_path\": \"<string>\",\n \"parent_folder_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_folder_id": "<string>",
"folder_name": "<string>",
"folder_path": "<string>",
"parent_folder_id": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Folder Policies
Create a folder policy for a connection
Create or update a folder policy for a specific connection.
POST
/
connections
/
{connection_id}
/
folder-policies
JavaScript
import Hyperspell from '@hyperspell/hyperspell';
const client = new Hyperspell({
apiKey: process.env['HYPERSPELL_API_KEY'], // This is the default and can be omitted
});
const response = await client.folders.setPolicies('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
provider_folder_id: 'provider_folder_id',
sync_mode: 'sync',
});
console.log(response.id);import os
from hyperspell import Hyperspell
client = Hyperspell(
api_key=os.environ.get("HYPERSPELL_API_KEY"), # This is the default and can be omitted
)
response = client.folders.set_policies(
connection_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
provider_folder_id="provider_folder_id",
sync_mode="sync",
)
print(response.id)package main
import (
"context"
"fmt"
"github.com/hyperspell/hyperspell-go"
"github.com/hyperspell/hyperspell-go/option"
)
func main() {
client := hyperspell.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Folders.SetPolicies(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
hyperspell.FolderSetPoliciesParams{
ProviderFolderID: "provider_folder_id",
SyncMode: hyperspell.FolderSetPoliciesParamsSyncModeSync,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.ID)
}
hyperspell folders set-policies \
--api-key 'My API Key' \
--connection-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \
--provider-folder-id provider_folder_id \
--sync-mode synccurl --request POST \
--url https://api.hyperspell.com/connections/{connection_id}/folder-policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider_folder_id": "<string>",
"folder_name": "<string>",
"folder_path": "<string>",
"parent_folder_id": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperspell.com/connections/{connection_id}/folder-policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider_folder_id' => '<string>',
'folder_name' => '<string>',
'folder_path' => '<string>',
'parent_folder_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.hyperspell.com/connections/{connection_id}/folder-policies")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider_folder_id\": \"<string>\",\n \"folder_name\": \"<string>\",\n \"folder_path\": \"<string>\",\n \"parent_folder_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperspell.com/connections/{connection_id}/folder-policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider_folder_id\": \"<string>\",\n \"folder_name\": \"<string>\",\n \"folder_path\": \"<string>\",\n \"parent_folder_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_folder_id": "<string>",
"folder_name": "<string>",
"folder_path": "<string>",
"parent_folder_id": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
APIKeyAsUser
API Key or JWT User Token. If using an API Key, set the X-As-User header to act as a specific user. A JWT User Token is always scoped to a specific user.
Path Parameters
Body
application/json
Folder ID from the source provider
Sync mode for this folder
Available options:
sync, skip, manual Display name of the folder
Display path of the folder
Parent folder's provider ID for inheritance resolution
Response
Successful Response
Unique policy ID
Folder ID from the source provider
Sync mode for this folder
Available options:
sync, skip, manual Display name of the folder
Display path of the folder
Parent folder's provider ID
Connection ID (null for integration defaults)
Was this page helpful?
⌘I