consumers
Switch Product
Switches the currently active product of a contract to a new product. A policy check will be performed to verify if the transition between both products is allowed. The old product will still be available but its validity is set until valid_from - 1. The new product will be created with validity starting from valid_from. The contract start (if supported by the products) which may be set with the old product will be reset to valid_from. The old product will maintain the initial contract start associated with the charging session start. The product switch is only possible for contracts which are in status “closed_join” (“Vertrag angemeldet” or “in Belieferung” in the cockpit).
POST
/
v3
/
consumers
/
{userID}
/
contracts
/
{contractID}
/
product
/
switch_product
/
Switch Product
curl --request POST \
--url https://api.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/ \
--header 'Content-Type: application/json' \
--data '
{
"product_name": "<string>",
"valid_from": "2023-12-25",
"product_specifics": {}
}
'import requests
url = "https://api.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/"
payload = {
"product_name": "<string>",
"valid_from": "2023-12-25",
"product_specifics": {}
}
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({product_name: '<string>', valid_from: '2023-12-25', product_specifics: {}})
};
fetch('https://api.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/', 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.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/",
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([
'product_name' => '<string>',
'valid_from' => '2023-12-25',
'product_specifics' => [
]
]),
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.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/"
payload := strings.NewReader("{\n \"product_name\": \"<string>\",\n \"valid_from\": \"2023-12-25\",\n \"product_specifics\": {}\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.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/")
.header("Content-Type", "application/json")
.body("{\n \"product_name\": \"<string>\",\n \"valid_from\": \"2023-12-25\",\n \"product_specifics\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/")
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 \"product_name\": \"<string>\",\n \"valid_from\": \"2023-12-25\",\n \"product_specifics\": {}\n}"
response = http.request(request)
puts response.read_body{
"consumer_id": "123456789",
"contract_id": "987654321"
}
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
⌘I
Switch Product
curl --request POST \
--url https://api.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/ \
--header 'Content-Type: application/json' \
--data '
{
"product_name": "<string>",
"valid_from": "2023-12-25",
"product_specifics": {}
}
'import requests
url = "https://api.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/"
payload = {
"product_name": "<string>",
"valid_from": "2023-12-25",
"product_specifics": {}
}
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({product_name: '<string>', valid_from: '2023-12-25', product_specifics: {}})
};
fetch('https://api.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/', 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.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/",
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([
'product_name' => '<string>',
'valid_from' => '2023-12-25',
'product_specifics' => [
]
]),
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.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/"
payload := strings.NewReader("{\n \"product_name\": \"<string>\",\n \"valid_from\": \"2023-12-25\",\n \"product_specifics\": {}\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.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/")
.header("Content-Type", "application/json")
.body("{\n \"product_name\": \"<string>\",\n \"valid_from\": \"2023-12-25\",\n \"product_specifics\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lumenaza.de/v3/consumers/{userID}/contracts/{contractID}/product/switch_product/")
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 \"product_name\": \"<string>\",\n \"valid_from\": \"2023-12-25\",\n \"product_specifics\": {}\n}"
response = http.request(request)
puts response.read_body{
"consumer_id": "123456789",
"contract_id": "987654321"
}

