SparkEnergyConfig
Get SparkEnergyConfig (GET)
Get default 3D Spark energy configuration.
Return Data
Parameter | Description | Type | Example |
name | Configuration Name | string | “3D Spark” |
uid | Unique ID | string | “6ba40dc05533401caa9f47f014efd1f8” |
co2eq_factor | Energy CO2 Equivalent [kg/kWh] | float | 0.5 |
{
"name": "3D Spark",
"uid": "a2bb84f5f9f24332884c50614e9c377f",
"co2eq_factor": 0.491
}
Errors
Precondition | Status code | Error message |
SparkEnergyConfig exists | 404 | No EnergyConfig matches the given query. |
Usage
# GET "https://platform.3dspark.de/api/v1/default-energy-config/"
this.axiosInstance
.get("/api/v1/default-energy-config/")
.then((response) => {
console.log(response.data);
})
EnergyConfig
Get EnergyConfig (Get)
Will return the serialized energy configuration by given uid.
If no uid is given, it will return default configuration of the users organization.
Return Data
Parameter | Description | Type | Example |
name | Configuration Name | string | “3D Spark” |
uid | Unique ID | string | “6ba40dc05533401caa9f47f014efd1f8” |
co2eq_factor | Energy CO2 Equivalent [kg/kWh] | float | 0.5 |
Errors
Precondition | Status code | Error message |
User is member of an organization | 400 | User is not a member of an organization. |
If no uid was passed, the organization has to have a default EnergyConfig | 400 | Organization has no default energy configuration. |
The user has access to the EnergyConfig passed by uid | 403 | Unauthorized request on energy configuration. |
The passed uid represents an existing EnergyConfig | 404 | Energy configuration not found. |
Usage
# GET "https://platform.3dspark.de/api/v1/energy-config/6ba40dc05533401caa9f47f014efd1f8/"
this.axiosInstance
.get("/api/v1/energy-config/")
.then((response) => {
console.log(response.data);
})
Create EnergyConfig (Post)
Create energy configuration
Form Data
Parameter | Description | Required | Type | Valid Values |
name | Configuration Name | true | string | [1, 255] |
co2eq_factor | Energy CO2 Equivalent [kg/kWh] | false | number | greater then 0 |
Return Data
See ‘Get EnergyConfig (Get)’
Errors
Precondition | Status code | Error message |
Form data is valid | 422 | Invalid user input. |
User is manager of the organization | 403 | Access forbidden. |
Usage
# POST "https://platform.3dspark.de/api/v1/energy-config/"
let formData = {
"name":"Renewable",
"co2eq_factor":0.2,
}
this.axiosInstance
.post("/api/v1/energy-config/", formData)
.then((response) => {
console.log(response.data);
})
Update EnergyConfig (Put)
Updates energy configuration
Form Data
Parameter | Description | Required | Type | Unit | Valid Values |
name | Configuration Name | false | string | | [1, 255] |
co2eq_factor | Energy CO2 Equivalent | false | number | kg/kWh | greater then 0 |
Return Data
See ‘Get EnergyConfig (Get)’
Errors
Precondition | Status code | Error message |
UID was passed | 400 | No UID specified. |
EnergyConfig exists | 404 | Configuration not found. |
User is member of an organization | 400 | User is not a member of an organization. |
User is manager of the organization | 403 | Access forbidden. |
Formdata are valid | 422 | Invalid user input. |
Usage
# PUT "https://platform.3dspark.de/api/v1/energy-config/<uid>/"
let formData = {
"name":"Renewable2",
"co2eq_factor": 0.3
}
this.axiosInstance
.put("/api/v1/energy-config/40db3e4bc1a14db0a78f44a327a67917/", formData)
.then((response) => {
console.log(response.data);
})
Delete EnergyConfig (Delete)
Deletes energy configuration
Return Data
"Deleted energy config: Renewable"
Error
Precondition | Status code | Error message |
UID was passed | 400 | No UID specified. |
User is member of an organization | 400 | User is not a member of an organization. |
User is manager of the organization | 403 | Access forbidden. |
EnergyConfig exists | 404 | Configuration not found. |
Usage
# DELETE "https://platform.3dspark.de/api/v1/energy-config/<uid>/"
this.axiosInstance
.put("/api/v1/energy-config/40db3e4bc1a14db0a78f44a327a67917/")
.then((response) => {
console.log(response.data);
})
DefaultEnergyConfig
Set default EnergyConfig (Post)
Set Default Energy Configuration for Organization
Return Data
Energy configuration for organization MyOrganization set to "Renewable".
Error
Precondition | Status code | Error message |
UID was passed | 400 | No UID specified. |
EnergyConfig exists | 404 | Invalid configuration uid specified. |
User is member of an organization | 400 | User is not a member of an organization. |
User is manager of the organization | 403 | Access forbidden. |
Usage
# POST "https://platform.3dspark.de/api/v1/energy-config-selection/<uid>/"
this.axiosInstance
.post("/api/v1/energy-config-selection/6ba40dc05533401caa9f47f014efd1f8/")
.then((response) => {
console.log(response.data);
})