curl --request POST \
--url https://api.ionworks.com/discovery/pybamm_models/validate \
--header 'Content-Type: application/json' \
--data '
{
"pybamm_model": "<string>",
"module": "lithium_ion",
"options": {}
}
'import requests
url = "https://api.ionworks.com/discovery/pybamm_models/validate"
payload = {
"pybamm_model": "<string>",
"module": "lithium_ion",
"options": {}
}
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({pybamm_model: '<string>', module: 'lithium_ion', options: {}})
};
fetch('https://api.ionworks.com/discovery/pybamm_models/validate', 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.ionworks.com/discovery/pybamm_models/validate",
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([
'pybamm_model' => '<string>',
'module' => 'lithium_ion',
'options' => [
]
]),
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://api.ionworks.com/discovery/pybamm_models/validate"
payload := strings.NewReader("{\n \"pybamm_model\": \"<string>\",\n \"module\": \"lithium_ion\",\n \"options\": {}\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://api.ionworks.com/discovery/pybamm_models/validate")
.header("Content-Type", "application/json")
.body("{\n \"pybamm_model\": \"<string>\",\n \"module\": \"lithium_ion\",\n \"options\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ionworks.com/discovery/pybamm_models/validate")
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 \"pybamm_model\": \"<string>\",\n \"module\": \"lithium_ion\",\n \"options\": {}\n}"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Validate Pybamm Model Config
Try to instantiate a pybamm/ionworks model with the given options.
Lightweight check that catches bad combinations of model name + options
before a record is persisted. Builds the model in-process — same code
path ModelService.get_pybamm_model_from_config uses at simulation
time — and reports whether construction succeeded.
On failure the response carries the underlying exception’s message
verbatim (typically a pybamm OptionError / ValueError) so the
caller can act on it.
The model is built and dropped; nothing is written to the database.
curl --request POST \
--url https://api.ionworks.com/discovery/pybamm_models/validate \
--header 'Content-Type: application/json' \
--data '
{
"pybamm_model": "<string>",
"module": "lithium_ion",
"options": {}
}
'import requests
url = "https://api.ionworks.com/discovery/pybamm_models/validate"
payload = {
"pybamm_model": "<string>",
"module": "lithium_ion",
"options": {}
}
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({pybamm_model: '<string>', module: 'lithium_ion', options: {}})
};
fetch('https://api.ionworks.com/discovery/pybamm_models/validate', 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.ionworks.com/discovery/pybamm_models/validate",
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([
'pybamm_model' => '<string>',
'module' => 'lithium_ion',
'options' => [
]
]),
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://api.ionworks.com/discovery/pybamm_models/validate"
payload := strings.NewReader("{\n \"pybamm_model\": \"<string>\",\n \"module\": \"lithium_ion\",\n \"options\": {}\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://api.ionworks.com/discovery/pybamm_models/validate")
.header("Content-Type", "application/json")
.body("{\n \"pybamm_model\": \"<string>\",\n \"module\": \"lithium_ion\",\n \"options\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ionworks.com/discovery/pybamm_models/validate")
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 \"pybamm_model\": \"<string>\",\n \"module\": \"lithium_ion\",\n \"options\": {}\n}"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
Body for POST /discovery/pybamm_models/validate.
Class name to instantiate, e.g. 'DFN', 'SPM', 'ECM'. Must be one of the names returned by GET /discovery/pybamm_models.
PyBaMM submodule the class lives under ('lithium_ion' or 'lead_acid'). Ignored for ionworks-specific models.
Options dict to pass to the model constructor.
Response
Successful Response
The response is of type Response Validate Pybamm Model Config Discovery Pybamm Models Validate Post · object.
Was this page helpful?