Skip to main content
POST
/
resources
/
{name}
/
apply
Applies a resource plan
curl --request POST \
  --url https://use.hoop.dev/api/resources/{name}/apply \
  --header 'Content-Type: application/json' \
  --data '
{
  "sid": "5701046A-7B7A-4A78-ABB0-A24C95E6FE54",
  "resource_name": "my-postgres"
}
'
import requests

url = "https://use.hoop.dev/api/resources/{name}/apply"

payload = {
    "sid": "5701046A-7B7A-4A78-ABB0-A24C95E6FE54",
    "resource_name": "my-postgres"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({sid: '5701046A-7B7A-4A78-ABB0-A24C95E6FE54', resource_name: 'my-postgres'})
};

fetch('https://use.hoop.dev/api/resources/{name}/apply', 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://use.hoop.dev/api/resources/{name}/apply",
  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([
    'sid' => '5701046A-7B7A-4A78-ABB0-A24C95E6FE54',
    'resource_name' => 'my-postgres'
  ]),
  CURLOPT_HTTPHEADER => [
    "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://use.hoop.dev/api/resources/{name}/apply"

	payload := strings.NewReader("{\n  \"sid\": \"5701046A-7B7A-4A78-ABB0-A24C95E6FE54\",\n  \"resource_name\": \"my-postgres\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	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://use.hoop.dev/api/resources/{name}/apply")
  .header("Content-Type", "application/json")
  .body("{\n  \"sid\": \"5701046A-7B7A-4A78-ABB0-A24C95E6FE54\",\n  \"resource_name\": \"my-postgres\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://use.hoop.dev/api/resources/{name}/apply")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"sid\": \"5701046A-7B7A-4A78-ABB0-A24C95E6FE54\",\n  \"resource_name\": \"my-postgres\"\n}"

response = http.request(request)
puts response.read_body
{
  "message": "failed obtaining blob stream: empty blob stream",
  "resource_name": "my-postgres",
  "sid": "5701046A-7B7A-4A78-ABB0-A24C95E6FE54",
  "status": "success"
}
{
  "message": "the error description"
}
{
  "message": "the error description"
}
{
  "message": "the error description"
}
{
  "message": "the error description"
}

Path Parameters

name
string
required

The resource name

Body

application/json

The request body

sid
string<uuid>
required

The Session ID of the plan to apply

Example:

"5701046A-7B7A-4A78-ABB0-A24C95E6FE54"

resource_name
string

The resource name to apply to. Required for batch requests.

Example:

"my-postgres"

Response

OK

message
string

Error message populated when status is "failed"; empty on success

Example:

"failed obtaining blob stream: empty blob stream"

resource_name
string

The resource name this apply result is for

Example:

"my-postgres"

sid
string<uuid>

The session ID for tracking and auditing this apply execution

Example:

"5701046A-7B7A-4A78-ABB0-A24C95E6FE54"

status
enum<string>

Status of the apply execution

Available options:
success,
failed
Example:

"success"