curl --request POST \
--url https://app.miget.com/api/v1/projects/{project_id}/resources \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"resource_id": "<string>",
"with_hosting_projects": false
}
'import requests
url = "https://app.miget.com/api/v1/projects/{project_id}/resources"
payload = {
"resource_id": "<string>",
"with_hosting_projects": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({resource_id: '<string>', with_hosting_projects: false})
};
fetch('https://app.miget.com/api/v1/projects/{project_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://app.miget.com/api/v1/projects/{project_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' => '<string>',
'with_hosting_projects' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.miget.com/api/v1/projects/{project_id}/resources"
payload := strings.NewReader("{\n \"resource_id\": \"<string>\",\n \"with_hosting_projects\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.miget.com/api/v1/projects/{project_id}/resources")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"resource_id\": \"<string>\",\n \"with_hosting_projects\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/projects/{project_id}/resources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"resource_id\": \"<string>\",\n \"with_hosting_projects\": false\n}"
response = http.request(request)
puts response.read_body{
"uuid": "<string>",
"name": "<string>",
"state": "<string>",
"labels": [
"<string>"
],
"total_disk_size": 123,
"total_ram_size": 123,
"total_cpu_size": 123,
"total_used_disk_size": 123,
"total_used_ram_size": 123,
"total_used_cpu_size": 123,
"available_cpu_size": 123,
"available_disk_size": 123,
"available_ram_size": 123,
"region_code": "<string>",
"component_quantities": [
{
"code_name": "1gb-ram",
"quantity": 2
}
],
"assigned": true,
"project_ids": [
"<string>"
],
"cron_minutes": {
"included": 123,
"used": 123,
"remaining": 123
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"plan": {
"name": "<string>",
"code_name": "<string>",
"description": "<string>",
"plan_type": "<string>",
"ram_size": 123,
"disk_size": 123,
"cpu_size": 123,
"unit_price": 123
},
"components": [
{
"name": "<string>",
"code_name": "<string>",
"unit_price": 123
}
]
}Assign a resource to a project
Assigns a resource to this project. Once a resource is assigned, only the projects it is assigned to may place workloads on it. Assigning restricts the resource, never the project — a project can always use any unassigned resource. Assigning is refused with 422 while the resource still runs workloads from a project it is not assigned to; send with_hosting_projects=true to assign it to those projects as well and let the call through. That is the only way past the refusal when a blocking project is one you cannot reach, because the error redacts its name.
curl --request POST \
--url https://app.miget.com/api/v1/projects/{project_id}/resources \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"resource_id": "<string>",
"with_hosting_projects": false
}
'import requests
url = "https://app.miget.com/api/v1/projects/{project_id}/resources"
payload = {
"resource_id": "<string>",
"with_hosting_projects": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({resource_id: '<string>', with_hosting_projects: false})
};
fetch('https://app.miget.com/api/v1/projects/{project_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://app.miget.com/api/v1/projects/{project_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' => '<string>',
'with_hosting_projects' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.miget.com/api/v1/projects/{project_id}/resources"
payload := strings.NewReader("{\n \"resource_id\": \"<string>\",\n \"with_hosting_projects\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.miget.com/api/v1/projects/{project_id}/resources")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"resource_id\": \"<string>\",\n \"with_hosting_projects\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/projects/{project_id}/resources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"resource_id\": \"<string>\",\n \"with_hosting_projects\": false\n}"
response = http.request(request)
puts response.read_body{
"uuid": "<string>",
"name": "<string>",
"state": "<string>",
"labels": [
"<string>"
],
"total_disk_size": 123,
"total_ram_size": 123,
"total_cpu_size": 123,
"total_used_disk_size": 123,
"total_used_ram_size": 123,
"total_used_cpu_size": 123,
"available_cpu_size": 123,
"available_disk_size": 123,
"available_ram_size": 123,
"region_code": "<string>",
"component_quantities": [
{
"code_name": "1gb-ram",
"quantity": 2
}
],
"assigned": true,
"project_ids": [
"<string>"
],
"cron_minutes": {
"included": 123,
"used": 123,
"remaining": 123
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"plan": {
"name": "<string>",
"code_name": "<string>",
"description": "<string>",
"plan_type": "<string>",
"ram_size": 123,
"disk_size": 123,
"cpu_size": 123,
"unit_price": 123
},
"components": [
{
"name": "<string>",
"code_name": "<string>",
"unit_price": 123
}
]
}Authorizations
Body
Response
Assign a resource to a project
Api_V1_Entities_Resource model
Components of the resource grouped by code_name, each {code_name, quantity}, the shape POST and PUT /resources accept as components. Empty when the resource has none. Use this for counts: the components list below renders identical units once
[{ "code_name": "1gb-ram", "quantity": 2 }]

