Vast.ai API
Network Volumes
create network-volume
1 min
code examples curl location request put 'https //console vast ai/api/v0/network volume/' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{"body" {"id" 0,"size" 0}}'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "body" { "id" 0, "size" 0 } }); var requestoptions = { method 'put', headers myheaders, body raw, redirect 'follow' }; fetch("https //console vast ai/api/v0/network volume/", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //console vast ai/api/v0/network volume/") https = net http new(url host, url port) https use ssl = true request = net http put new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "body" { "id" 0, "size" 0 } }) response = https request(request) puts response read body import requests import json url = "https //console vast ai/api/v0/network volume/" payload = json dumps({ "body" { "id" 0, "size" 0 } }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("put", url, headers=headers, data=payload) print(response text) responses // successful response { "success" false, "volume name" "", "volume size" 0 }// bad request { "error" "invalid args", "msg" "you must pass in `id` in the body of the request" }// forbidden { "error" "not authorized", "msg" "authorization error check that you have proper privileges to perform this action " }