Upload a new module
curl --request POST \
--url https://hdp.api.herodotus.cloud/modules/upload \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: <api-key>'import requests
url = "https://hdp.api.herodotus.cloud/modules/upload"
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'multipart/form-data'}
};
fetch('https://hdp.api.herodotus.cloud/modules/upload', 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://hdp.api.herodotus.cloud/modules/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://hdp.api.herodotus.cloud/modules/upload"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "multipart/form-data")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://hdp.api.herodotus.cloud/modules/upload")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "multipart/form-data")
.asString();require 'uri'
require 'net/http'
url = URI("https://hdp.api.herodotus.cloud/modules/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"programHash": "<string>"
}modules
Upload a new module
Upload a compiled Cairo module as a ZIP file. The ZIP should contain the source code (src/ directory), Scarb.toml, and the compiled program JSON. The module will be compiled and stored for later use in HDP tasks.
POST
/
modules
/
upload
Upload a new module
curl --request POST \
--url https://hdp.api.herodotus.cloud/modules/upload \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: <api-key>'import requests
url = "https://hdp.api.herodotus.cloud/modules/upload"
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'multipart/form-data'}
};
fetch('https://hdp.api.herodotus.cloud/modules/upload', 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://hdp.api.herodotus.cloud/modules/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://hdp.api.herodotus.cloud/modules/upload"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "multipart/form-data")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://hdp.api.herodotus.cloud/modules/upload")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "multipart/form-data")
.asString();require 'uri'
require 'net/http'
url = URI("https://hdp.api.herodotus.cloud/modules/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"programHash": "<string>"
}Was this page helpful?

