Appearance
任务暂停
此接口【v1.2.31版本有变动】
接口信息
- 接口:
/agent-api/user/{user_id}/task_stop/{task_id} - 请求方式:
GET
路由参数
| 参数 | 类型 | 示例 | 说明 | 必填 |
|---|---|---|---|---|
| user_id | string | 5832d184-dd53-42a0-8ace-0bf8d660f4cc | 用户id | 是 |
| task_id | string | f232d184-dd54-42a0-8ace-0bf8d660f4cc | 任务id | 是 |
| sub_user_id | string | 79bed1c5-5775-42ce-a50d-217af3c50652 | 子账户id | 否 |
请求示例
cURL
curl -X GET "https://ai.api.longlonglong.cn/agent-api/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task_stop/f232d184-dd54-42a0-8ace-0bf8d660f4cc?sub_user_id=79bed1c5-5775-42ce-a50d-217af3c50652" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"Go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
userId := "5832d184-dd53-42a0-8ace-0bf8d660f4cc"
taskId := "f232d184-dd54-42a0-8ace-0bf8d660f4cc"
subUserId := "79bed1c5-5775-42ce-a50d-217af3c50652"
client := &http.Client{}
url := fmt.Sprintf("https://ai.api.longlonglong.cn/agent-api/user/%s/task_stop/%s?sub_user_id=%s", userId, taskId, subUserId)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("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 userId = '5832d184-dd53-42a0-8ace-0bf8d660f4cc';
const taskId = 'f232d184-dd54-42a0-8ace-0bf8d660f4cc';
const subUserId = '79bed1c5-5775-42ce-a50d-217af3c50652';
const url = new URL(`https://ai.api.longlonglong.cn/agent-api/user/${userId}/task_stop/${taskId}`);
url.searchParams.append('sub_user_id', subUserId);
fetch(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));Java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
String userId = "5832d184-dd53-42a0-8ace-0bf8d660f4cc";
String taskId = "f232d184-dd54-42a0-8ace-0bf8d660f4cc";
String subUserId = "79bed1c5-5775-42ce-a50d-217af3c50652";
try {
URL url = new URL("https://ai.api.longlonglong.cn/agent-api/user/" + userId + "/task_stop/" + taskId + "?sub_user_id=" + subUserId);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", "Bearer YOUR_TOKEN");
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
StringBuilder response = new StringBuilder();
while ((line = br.readLine()) != null) {
response.append(line);
}
br.close();
System.out.println(response.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}PHP
<?php
$userId = '5832d184-dd53-42a0-8ace-0bf8d660f4cc';
$taskId = 'f232d184-dd54-42a0-8ace-0bf8d660f4cc';
$subUserId = '79bed1c5-5775-42ce-a50d-217af3c50652';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://ai.api.longlonglong.cn/agent-api/user/' . $userId . '/task_stop/' . $taskId . '?sub_user_id=' . $subUserId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer YOUR_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;Python
import requests
user_id = "5832d184-dd53-42a0-8ace-0bf8d660f4cc"
task_id = "f232d184-dd54-42a0-8ace-0bf8d660f4cc"
sub_user_id = "79bed1c5-5775-42ce-a50d-217af3c50652"
url = f"https://ai.api.longlonglong.cn/agent-api/user/{user_id}/task_stop/{task_id}"
params = {
"sub_user_id": sub_user_id
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN"
}
response = requests.get(url, params=params, headers=headers)
print(response.json())C++
#include <iostream>
#include <curl/curl.h>
#include <string>
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() {
std::string userId = "5832d184-dd53-42a0-8ace-0bf8d660f4cc";
std::string taskId = "f232d184-dd54-42a0-8ace-0bf8d660f4cc";
std::string subUserId = "79bed1c5-5775-42ce-a50d-217af3c50652";
CURL* curl;
CURLcode res;
std::string readBuffer;
curl = curl_easy_init();
if(curl) {
std::string url = "https://ai.api.longlonglong.cn/agent-api/user/" + userId + "/task_stop/" + taskId + "?sub_user_id=" + subUserId;
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
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
{
"status": "success",
"code": 200,
"message": "暂停任务成功"
}