Skip to content

解除线路绑定用户

接口信息

  • 接口: /agent-api/new/user/{user_id}/line/{id}
  • 请求方式: DELETE

路由参数

参数类型示例解释必填
user_idstringb6d94bef-5ac2-4c6e-ba13-d2f8f124862b用户 id
idint11分配记录 id

注意事项

分配记录 id 为线路列表记录中的 line_allocation.id

请求示例

cURL
curl -X DELETE "https://ai.api.longlonglong.cn/agent-api/new/user/b6d94bef-5ac2-4c6e-ba13-d2f8f124862b/line/11" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"
Go
package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() {
    client := &http.Client{}
    req, err := http.NewRequest("DELETE", "https://ai.api.longlonglong.cn/agent-api/new/user/b6d94bef-5ac2-4c6e-ba13-d2f8f124862b/line/11", nil)
    if err != nil {
        panic(err)
    }
    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("Authorization", "Bearer YOUR_TOKEN")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
JavaScript
const axios = require('axios');

axios.delete('https://ai.api.longlonglong.cn/agent-api/new/user/b6d94bef-5ac2-4c6e-ba13-d2f8f124862b/line/11', {
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_TOKEN'
    }
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error(error);
});
Java
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 {
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://ai.api.longlonglong.cn/agent-api/new/user/b6d94bef-5ac2-4c6e-ba13-d2f8f124862b/line/11"))
            .header("Content-Type", "application/json")
            .header("Authorization", "Bearer YOUR_TOKEN")
            .DELETE()
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
PHP
<?php

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://ai.api.longlonglong.cn/agent-api/new/user/b6d94bef-5ac2-4c6e-ba13-d2f8f124862b/line/11');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer YOUR_TOKEN'
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
Python
import requests

url = 'https://ai.api.longlonglong.cn/agent-api/new/user/b6d94bef-5ac2-4c6e-ba13-d2f8f124862b/line/11'
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
}

response = requests.delete(url, headers=headers)
print(response.json())
C++
#include <iostream>
#include <curl/curl.h>

size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
    ((std::string*)userp)->append((char*)contents, size * nmemb);
    return size * nmemb;
}

int main() {
    CURL* curl;
    CURLcode res;
    std::string readBuffer;

    curl = curl_easy_init();
    if(curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/new/user/b6d94bef-5ac2-4c6e-ba13-d2f8f124862b/line/11");
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
        struct curl_slist* headers = NULL;
        headers = curl_slist_append(headers, "Content-Type: application/json");
        headers = curl_slist_append(headers, "Authorization: Bearer YOUR_TOKEN");
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);

        res = curl_easy_perform(curl);
        if(res != CURLE_OK) {
            fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
        } else {
            std::cout << readBuffer << std::endl;
        }

        curl_easy_cleanup(curl);
    }
    return 0;
}

返回结果

成功响应

json
{
    "code": 200,
    "status": "success",
    "message": "取消线路绑定成功",
    "data": []
}

错误响应

解除绑定,需要确定任务未占用并发

json
{
    "code": 422,
    "status": "error",
    "message": "有任务占用线路并发",
    "data": []
}

基于 MIT 许可发布