Rename a charging key
curl --request PUT \
--url https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"newName": "SE6F1K2C3"
}
'import requests
url = "https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename"
payload = { "newName": "SE6F1K2C3" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({newName: 'SE6F1K2C3'})
};
fetch('https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename', 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://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'newName' => 'SE6F1K2C3'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename"
payload := strings.NewReader("{\n \"newName\": \"SE6F1K2C3\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.put("https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"newName\": \"SE6F1K2C3\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"newName\": \"SE6F1K2C3\"\n}"
response = http.request(request)
puts response.read_body{
"name": "SE6F1K2C3",
"keyIdentifier": "3633e0e0",
"validTo": "2022-01-24T11:25:54.210Z",
"fleetId": "y1nNLJqb7m",
"contractId": "DE-9FS-C045DS363-E",
"visualNumber": "6285629402937",
"enabled": true,
"whitelist": "NEVER"
}{
"message": "Invalid request payload",
"details": [
"field X is required"
]
}{
"message": "Resource not found"
}EMP Charging Keys
Rename a charging key
Renames a charging key given its key identifier
PUT
/
emp
/
v1
/
charging-keys
/
{keyIdentifier}
/
rename
Rename a charging key
curl --request PUT \
--url https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"newName": "SE6F1K2C3"
}
'import requests
url = "https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename"
payload = { "newName": "SE6F1K2C3" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({newName: 'SE6F1K2C3'})
};
fetch('https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename', 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://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'newName' => 'SE6F1K2C3'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename"
payload := strings.NewReader("{\n \"newName\": \"SE6F1K2C3\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.put("https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"newName\": \"SE6F1K2C3\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.plugsurfing.com/emp/v1/charging-keys/{keyIdentifier}/rename")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"newName\": \"SE6F1K2C3\"\n}"
response = http.request(request)
puts response.read_body{
"name": "SE6F1K2C3",
"keyIdentifier": "3633e0e0",
"validTo": "2022-01-24T11:25:54.210Z",
"fleetId": "y1nNLJqb7m",
"contractId": "DE-9FS-C045DS363-E",
"visualNumber": "6285629402937",
"enabled": true,
"whitelist": "NEVER"
}{
"message": "Invalid request payload",
"details": [
"field X is required"
]
}{
"message": "Resource not found"
}Body
application/json
Response
Succeed
EMP charging key details returned by key management endpoints.