获取 Token
curl --request POST \
--url https://leapx-hub.com/prod-api/v3/auth/getToken \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"password": "<string>"
}
'import requests
url = "https://leapx-hub.com/prod-api/v3/auth/getToken"
payload = {
"username": "<string>",
"password": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({username: '<string>', password: '<string>'})
};
fetch('https://leapx-hub.com/prod-api/v3/auth/getToken', 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://leapx-hub.com/prod-api/v3/auth/getToken",
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([
'username' => '<string>',
'password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://leapx-hub.com/prod-api/v3/auth/getToken"
payload := strings.NewReader("{\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://leapx-hub.com/prod-api/v3/auth/getToken")
.header("Content-Type", "application/json")
.body("{\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://leapx-hub.com/prod-api/v3/auth/getToken")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "操作成功",
"data": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}
认证
获取 Token
POST
/
prod-api
/
v3
/
auth
/
getToken
获取 Token
curl --request POST \
--url https://leapx-hub.com/prod-api/v3/auth/getToken \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"password": "<string>"
}
'import requests
url = "https://leapx-hub.com/prod-api/v3/auth/getToken"
payload = {
"username": "<string>",
"password": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({username: '<string>', password: '<string>'})
};
fetch('https://leapx-hub.com/prod-api/v3/auth/getToken', 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://leapx-hub.com/prod-api/v3/auth/getToken",
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([
'username' => '<string>',
'password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://leapx-hub.com/prod-api/v3/auth/getToken"
payload := strings.NewReader("{\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://leapx-hub.com/prod-api/v3/auth/getToken")
.header("Content-Type", "application/json")
.body("{\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://leapx-hub.com/prod-api/v3/auth/getToken")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "操作成功",
"data": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}
简介
通过用户名和密码获取访问令牌(Token),用于后续接口调用的身份验证。请求参数
string
必填
用户名
string
必填
密码
示例代码
- cURL示例
- Python示例
curl -X POST "https://leapx-hub.com/prod-api/v3/auth/getToken" \
-H "Content-Type: application/json" \
-d '{
"username": "your_username",
"password": "your_password"
}'
import requests
import json
url = "https://leapx-hub.com/prod-api/v3/auth/getToken"
headers = {
"Content-Type": "application/json"
}
data = {
"username": "your_username",
"password": "your_password"
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
响应示例
{
"code": 200,
"msg": "操作成功",
"data": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}
⌘I
