Xóa xe
Xóa một xe của bạn.
Xe thiết lập sẵn chỉ đọc. Miễn phí: không trừ credit.
Xác thực
Tham số đường dẫn
idstringbắt buộcID xe thiết lập sẵn hoặc ID xe của bạn (veh_…).
Yêu cầu mẫu
curl -X DELETE "https://runner.cargoduo.com/v1/vehicles/veh_118" \
-H "Authorization: Bearer $CARGODUO_API_KEY"const res = await fetch("https://runner.cargoduo.com/v1/vehicles/veh_118", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.CARGODUO_API_KEY}`,
},
});
const data = await res.json();
console.log(res.status, data);import os
import requests
response = requests.delete(
"https://runner.cargoduo.com/v1/vehicles/veh_118",
headers={"Authorization": f"Bearer {os.environ['CARGODUO_API_KEY']}"},
)
print(response.status_code, response.json())package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("DELETE", "https://runner.cargoduo.com/v1/vehicles/veh_118", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("CARGODUO_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(out))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://runner.cargoduo.com/v1/vehicles/veh_118"))
.header("Authorization", "Bearer " + System.getenv("CARGODUO_API_KEY"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System.Net.Http.Headers;
using System.Text;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("CARGODUO_API_KEY"));
var request = new HttpRequestMessage(HttpMethod.Delete, "https://runner.cargoduo.com/v1/vehicles/veh_118");
var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");<?php
$ch = curl_init('https://runner.cargoduo.com/v1/vehicles/veh_118');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CARGODUO_API_KEY'),
],
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), ' ', $response, PHP_EOL;require "net/http"
require "uri"
uri = URI("https://runner.cargoduo.com/v1/vehicles/veh_118")
request = Net::HTTP::Delete.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("CARGODUO_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts response.code, response.bodyPhản hồi mẫu
{
"id": "veh_118",
"object": "vehicle",
"deleted": true
}Phản hồi
200OKĐã xóa.
TênKiểuBắt buộcMô tảidstringstringKhôngobjectstringstringKhôngvehicletemplateprojectdeletedbooleanbooleanKhôngLuôn là
true.401Unauthorized
unauthorizedkey_revokedkey_expiredunauthorizedThiếu khóa API, khóa sai định dạng hoặc không xác định.key_revokedKhóa đã bị thu hồi.key_expiredKhóa đã quá ngày hết hạn.
Tất cả mã lỗiTênKiểuBắt buộcMô tảerrorErrorBodybắt buộcErrorBodyCócodestringbắt buộcstringCóMã dành cho máy (snake_case). Hãy dựa vào mã này để xử lý lỗi, không bao giờ dựa vào
message.messagestringbắt buộcstringCóGiải thích bằng tiếng Anh.
request_idstringbắt buộcstringCóGiống header X-Request-Id. Cung cấp mã này khi liên hệ bộ phận hỗ trợ.
detailsErrorDetail[]ErrorDetail[]KhôngLỗi theo từng trường (
validation_failed).pathstringstringKhôngĐường dẫn JSON của trường bị lỗi, ví dụ items[3].length.
codestringstringKhôngrequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringKhôngGiải thích bằng tiếng Anh.
403Forbidden
preset_read_onlyip_not_allowedsubscription_inactiveaccount_inactivescope_missingpreset_read_onlyKhông thể thay đổi hoặc xóa xe thiết lập sẵn.ip_not_allowedIP gọi đến không nằm trong danh sách IP được phép của khóa.subscription_inactiveTổ chức không có gói đăng ký đang hoạt động nào bao gồm API.account_inactiveTổ chức bị tạm ngưng, hoặc không có chủ sở hữu nào có tài khoản đang hoạt động.scope_missingKhóa thiếu phạm vi quyền mà endpoint này yêu cầu.
Tất cả mã lỗiTênKiểuBắt buộcMô tảerrorErrorBodybắt buộcErrorBodyCócodestringbắt buộcstringCóMã dành cho máy (snake_case). Hãy dựa vào mã này để xử lý lỗi, không bao giờ dựa vào
message.messagestringbắt buộcstringCóGiải thích bằng tiếng Anh.
request_idstringbắt buộcstringCóGiống header X-Request-Id. Cung cấp mã này khi liên hệ bộ phận hỗ trợ.
detailsErrorDetail[]ErrorDetail[]KhôngLỗi theo từng trường (
validation_failed).pathstringstringKhôngĐường dẫn JSON của trường bị lỗi, ví dụ items[3].length.
codestringstringKhôngrequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringKhôngGiải thích bằng tiếng Anh.
404Not found
vehicle_not_foundvehicle_not_foundKhông có xe nào với ID này trong số xe thiết lập sẵn hoặc xe của tổ chức.
Tất cả mã lỗiTênKiểuBắt buộcMô tảerrorErrorBodybắt buộcErrorBodyCócodestringbắt buộcstringCóMã dành cho máy (snake_case). Hãy dựa vào mã này để xử lý lỗi, không bao giờ dựa vào
message.messagestringbắt buộcstringCóGiải thích bằng tiếng Anh.
request_idstringbắt buộcstringCóGiống header X-Request-Id. Cung cấp mã này khi liên hệ bộ phận hỗ trợ.
detailsErrorDetail[]ErrorDetail[]KhôngLỗi theo từng trường (
validation_failed).pathstringstringKhôngĐường dẫn JSON của trường bị lỗi, ví dụ items[3].length.
codestringstringKhôngrequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringKhôngGiải thích bằng tiếng Anh.
429Too many requests
rate_limitedrate_limitedQuá nhiều yêu cầu trong phút, giờ hoặc ngày hiện tại (theo khóa hoặc theo tổ chức), hoặc có hơn 60 lần xác thực thất bại mỗi phút từ địa chỉ IP của bạn.
Tất cả mã lỗiTênKiểuBắt buộcMô tảerrorErrorBodybắt buộcErrorBodyCócodestringbắt buộcstringCóMã dành cho máy (snake_case). Hãy dựa vào mã này để xử lý lỗi, không bao giờ dựa vào
message.messagestringbắt buộcstringCóGiải thích bằng tiếng Anh.
request_idstringbắt buộcstringCóGiống header X-Request-Id. Cung cấp mã này khi liên hệ bộ phận hỗ trợ.
detailsErrorDetail[]ErrorDetail[]KhôngLỗi theo từng trường (
validation_failed).pathstringstringKhôngĐường dẫn JSON của trường bị lỗi, ví dụ items[3].length.
codestringstringKhôngrequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringKhôngGiải thích bằng tiếng Anh.
500Internal server error
internal_errorinternal_errorĐã xảy ra lỗi ở phía chúng tôi.
Tất cả mã lỗiTênKiểuBắt buộcMô tảerrorErrorBodybắt buộcErrorBodyCócodestringbắt buộcstringCóMã dành cho máy (snake_case). Hãy dựa vào mã này để xử lý lỗi, không bao giờ dựa vào
message.messagestringbắt buộcstringCóGiải thích bằng tiếng Anh.
request_idstringbắt buộcstringCóGiống header X-Request-Id. Cung cấp mã này khi liên hệ bộ phận hỗ trợ.
detailsErrorDetail[]ErrorDetail[]KhôngLỗi theo từng trường (
validation_failed).pathstringstringKhôngĐường dẫn JSON của trường bị lỗi, ví dụ items[3].length.
codestringstringKhôngrequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringKhôngGiải thích bằng tiếng Anh.
503Service unavailable
api_disabledapi_disabledAPI tạm thời bị tắt (bảo trì) hoặc đã bị tắt cho tổ chức.
Tất cả mã lỗiTênKiểuBắt buộcMô tảerrorErrorBodybắt buộcErrorBodyCócodestringbắt buộcstringCóMã dành cho máy (snake_case). Hãy dựa vào mã này để xử lý lỗi, không bao giờ dựa vào
message.messagestringbắt buộcstringCóGiải thích bằng tiếng Anh.
request_idstringbắt buộcstringCóGiống header X-Request-Id. Cung cấp mã này khi liên hệ bộ phận hỗ trợ.
detailsErrorDetail[]ErrorDetail[]KhôngLỗi theo từng trường (
validation_failed).pathstringstringKhôngĐường dẫn JSON của trường bị lỗi, ví dụ items[3].length.
codestringstringKhôngrequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringKhôngGiải thích bằng tiếng Anh.