CORS Policies
Update CORS policy
Update an existing CORS policy rule on the object storage bucket. All fields must be provided as the rule is fully replaced.
PATCH
/
object-storage
/
{id}
/
cors-policies
/
{cors_policy_id}
Update CORS policy
curl --request PATCH \
--url https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"methods": [
"GET",
"PUT"
],
"origins": [
"https://example.com"
],
"headers": [
"Content-Type"
]
}
'import requests
url = "https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}"
payload = {
"methods": ["GET", "PUT"],
"origins": ["https://example.com"],
"headers": ["Content-Type"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
methods: ['GET', 'PUT'],
origins: ['https://example.com'],
headers: ['Content-Type']
})
};
fetch('https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'methods' => [
'GET',
'PUT'
],
'origins' => [
'https://example.com'
],
'headers' => [
'Content-Type'
]
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}"
payload := strings.NewReader("{\n \"methods\": [\n \"GET\",\n \"PUT\"\n ],\n \"origins\": [\n \"https://example.com\"\n ],\n \"headers\": [\n \"Content-Type\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"methods\": [\n \"GET\",\n \"PUT\"\n ],\n \"origins\": [\n \"https://example.com\"\n ],\n \"headers\": [\n \"Content-Type\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"methods\": [\n \"GET\",\n \"PUT\"\n ],\n \"origins\": [\n \"https://example.com\"\n ],\n \"headers\": [\n \"Content-Type\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "CORS policy updated"
}{
"message": "Bad request",
"status": 400,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Unauthorized",
"status": 401,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Forbidden",
"status": 403,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Not found",
"status": 404,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Too many requests",
"status": 429,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Internal Server Error",
"status": 500,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}Authorizations
API key authentication. Pass your API key as a Bearer token in the Authorization header.
Path Parameters
Object storage bucket identifier
Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Example:
"fb5e5168-4281-4bec-94c5-0d1584e9e657"
CORS policy rule identifier
Example:
"fb5e5168-4281-4bec-94c5-0d1584e9e657"
Body
application/json
HTTP methods allowed by this CORS rule. GET - read objects. PUT - upload objects. POST - create objects. DELETE - remove objects. HEAD - retrieve object metadata.
Minimum array length:
1Available options:
GET, PUT, POST, DELETE, HEAD Example:
["GET", "PUT"]
Origins allowed by this CORS rule. Use "*" to allow all origins. Maximum 100 origins.
Required array length:
1 - 100 elementsRequired string length:
1 - 250Example:
["https://example.com"]
HTTP headers allowed in CORS requests. Maximum 100 headers.
Maximum array length:
100Required string length:
1 - 250Example:
["Content-Type"]
Response
Default Response
Confirmation message
Example:
"CORS policy updated"
Was this page helpful?
⌘I
Update CORS policy
curl --request PATCH \
--url https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"methods": [
"GET",
"PUT"
],
"origins": [
"https://example.com"
],
"headers": [
"Content-Type"
]
}
'import requests
url = "https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}"
payload = {
"methods": ["GET", "PUT"],
"origins": ["https://example.com"],
"headers": ["Content-Type"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
methods: ['GET', 'PUT'],
origins: ['https://example.com'],
headers: ['Content-Type']
})
};
fetch('https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'methods' => [
'GET',
'PUT'
],
'origins' => [
'https://example.com'
],
'headers' => [
'Content-Type'
]
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}"
payload := strings.NewReader("{\n \"methods\": [\n \"GET\",\n \"PUT\"\n ],\n \"origins\": [\n \"https://example.com\"\n ],\n \"headers\": [\n \"Content-Type\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"methods\": [\n \"GET\",\n \"PUT\"\n ],\n \"origins\": [\n \"https://example.com\"\n ],\n \"headers\": [\n \"Content-Type\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sevalla.com/v3/object-storage/{id}/cors-policies/{cors_policy_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"methods\": [\n \"GET\",\n \"PUT\"\n ],\n \"origins\": [\n \"https://example.com\"\n ],\n \"headers\": [\n \"Content-Type\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "CORS policy updated"
}{
"message": "Bad request",
"status": 400,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Unauthorized",
"status": 401,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Forbidden",
"status": 403,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Not found",
"status": 404,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Too many requests",
"status": 429,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Internal Server Error",
"status": 500,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}