Charge-refused event
Send notification that the vehicle stopped drawing the power the device offers, for any reason: the charge is complete, the vehicle has reached its own charge limit, or it won’t charge for now.
curl --request POST \
--url https://api-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"occurred_at": "2023-11-07T05:31:56Z",
"external_session_id": "<string>"
}
'import requests
url = "https://api-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused"
payload = {
"occurred_at": "2023-11-07T05:31:56Z",
"external_session_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({occurred_at: '2023-11-07T05:31:56Z', external_session_id: '<string>'})
};
fetch('https://api-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused', 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-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused",
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([
'occurred_at' => '2023-11-07T05:31:56Z',
'external_session_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused"
payload := strings.NewReader("{\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"external_session_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"external_session_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"external_session_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
Request model for a vehicle refusing charge the device offers, for any reason: the charge is complete, the vehicle has reached its own charge limit, or it won't charge for now, for example while its battery is cold.
When the event happened on the device, with a UTC offset. Send the device's time rather than the time your system received or forwarded the event: Axle uses it to work out how fast the vehicle is charging and whether the charge is on track, and a delay between the device and your API would otherwise skew both.
Response
Charge refused event successfully processed
Was this page helpful?
curl --request POST \
--url https://api-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"occurred_at": "2023-11-07T05:31:56Z",
"external_session_id": "<string>"
}
'import requests
url = "https://api-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused"
payload = {
"occurred_at": "2023-11-07T05:31:56Z",
"external_session_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({occurred_at: '2023-11-07T05:31:56Z', external_session_id: '<string>'})
};
fetch('https://api-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused', 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-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused",
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([
'occurred_at' => '2023-11-07T05:31:56Z',
'external_session_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused"
payload := strings.NewReader("{\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"external_session_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"external_session_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.axle.energy/entities/asset/{asset_id}/event/charge-refused")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"external_session_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
