cURL
curl --request POST \
--url https://api.opal.dev/v1/bundles/{bundle_id}/resources \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"resource_id": "72e75a6f-7183-48c5-94ff-6013f213314b",
"access_level_remote_id": "arn:aws:iam::590304332660:role/AdministratorAccess",
"access_level_name": "AdministratorAccess"
}
'import requests
url = "https://api.opal.dev/v1/bundles/{bundle_id}/resources"
payload = {
"resource_id": "72e75a6f-7183-48c5-94ff-6013f213314b",
"access_level_remote_id": "arn:aws:iam::590304332660:role/AdministratorAccess",
"access_level_name": "AdministratorAccess"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
resource_id: '72e75a6f-7183-48c5-94ff-6013f213314b',
access_level_remote_id: 'arn:aws:iam::590304332660:role/AdministratorAccess',
access_level_name: 'AdministratorAccess'
})
};
fetch('https://api.opal.dev/v1/bundles/{bundle_id}/resources', 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.opal.dev/v1/bundles/{bundle_id}/resources",
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([
'resource_id' => '72e75a6f-7183-48c5-94ff-6013f213314b',
'access_level_remote_id' => 'arn:aws:iam::590304332660:role/AdministratorAccess',
'access_level_name' => 'AdministratorAccess'
]),
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.opal.dev/v1/bundles/{bundle_id}/resources"
payload := strings.NewReader("{\n \"resource_id\": \"72e75a6f-7183-48c5-94ff-6013f213314b\",\n \"access_level_remote_id\": \"arn:aws:iam::590304332660:role/AdministratorAccess\",\n \"access_level_name\": \"AdministratorAccess\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.opal.dev/v1/bundles/{bundle_id}/resources")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"resource_id\": \"72e75a6f-7183-48c5-94ff-6013f213314b\",\n \"access_level_remote_id\": \"arn:aws:iam::590304332660:role/AdministratorAccess\",\n \"access_level_name\": \"AdministratorAccess\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/bundles/{bundle_id}/resources")
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 \"resource_id\": \"72e75a6f-7183-48c5-94ff-6013f213314b\",\n \"access_level_remote_id\": \"arn:aws:iam::590304332660:role/AdministratorAccess\",\n \"access_level_name\": \"AdministratorAccess\"\n}"
response = http.request(request)
puts response.read_body{
"bundle_id": "a381e7a3-e5e0-4c48-b1d6-4ccb4c191bc1",
"resource_id": "a381e7a3-e5e0-4c48-b1d6-4ccb4c191bc1",
"access_level_name": "Read",
"access_level_remote_id": "arn:aws:iam::490306337630:role/SupportUser"
}Post bundles resources
Adds a resource to a bundle.
POST
/
bundles
/
{bundle_id}
/
resources
cURL
curl --request POST \
--url https://api.opal.dev/v1/bundles/{bundle_id}/resources \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"resource_id": "72e75a6f-7183-48c5-94ff-6013f213314b",
"access_level_remote_id": "arn:aws:iam::590304332660:role/AdministratorAccess",
"access_level_name": "AdministratorAccess"
}
'import requests
url = "https://api.opal.dev/v1/bundles/{bundle_id}/resources"
payload = {
"resource_id": "72e75a6f-7183-48c5-94ff-6013f213314b",
"access_level_remote_id": "arn:aws:iam::590304332660:role/AdministratorAccess",
"access_level_name": "AdministratorAccess"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
resource_id: '72e75a6f-7183-48c5-94ff-6013f213314b',
access_level_remote_id: 'arn:aws:iam::590304332660:role/AdministratorAccess',
access_level_name: 'AdministratorAccess'
})
};
fetch('https://api.opal.dev/v1/bundles/{bundle_id}/resources', 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.opal.dev/v1/bundles/{bundle_id}/resources",
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([
'resource_id' => '72e75a6f-7183-48c5-94ff-6013f213314b',
'access_level_remote_id' => 'arn:aws:iam::590304332660:role/AdministratorAccess',
'access_level_name' => 'AdministratorAccess'
]),
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.opal.dev/v1/bundles/{bundle_id}/resources"
payload := strings.NewReader("{\n \"resource_id\": \"72e75a6f-7183-48c5-94ff-6013f213314b\",\n \"access_level_remote_id\": \"arn:aws:iam::590304332660:role/AdministratorAccess\",\n \"access_level_name\": \"AdministratorAccess\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.opal.dev/v1/bundles/{bundle_id}/resources")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"resource_id\": \"72e75a6f-7183-48c5-94ff-6013f213314b\",\n \"access_level_remote_id\": \"arn:aws:iam::590304332660:role/AdministratorAccess\",\n \"access_level_name\": \"AdministratorAccess\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/bundles/{bundle_id}/resources")
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 \"resource_id\": \"72e75a6f-7183-48c5-94ff-6013f213314b\",\n \"access_level_remote_id\": \"arn:aws:iam::590304332660:role/AdministratorAccess\",\n \"access_level_name\": \"AdministratorAccess\"\n}"
response = http.request(request)
puts response.read_body{
"bundle_id": "a381e7a3-e5e0-4c48-b1d6-4ccb4c191bc1",
"resource_id": "a381e7a3-e5e0-4c48-b1d6-4ccb4c191bc1",
"access_level_name": "Read",
"access_level_remote_id": "arn:aws:iam::490306337630:role/SupportUser"
}Authorizations
Body
application/json
Response
201 - application/json
Resource was successfully added to the bundle.
Was this page helpful?