GET /bank-accounts/all
ดูรายการบัญชีธนาคาร ทั้งหมด ใน Service ของคุณ — ไม่ใช่แค่บัญชีที่เชื่อมโยงกับ Branch ที่เรียกใช้ ผลลัพธ์แบ่งหน้า (paginated) และไม่รวมบัญชีที่ถูกลบ
ใช้สำหรับค้นหาบัญชีที่คุณเคยยกเลิกการเชื่อมโยง ออกจาก Branch ของคุณ (ซึ่งทำให้หลุดจาก GET /bank-accounts) เพื่อจะได้เชื่อมโยงกลับ
Endpoint
http
GET /bank-accounts/allURL เต็ม: https://api.easyslip.com/v2/bank-accounts/all
การยืนยันตัวตน
จำเป็น ดูคู่มือการยืนยันตัวตน
http
Authorization: Bearer YOUR_API_KEYRequest
Query Parameters
| พารามิเตอร์ | ชนิด | จำเป็น | คำอธิบาย |
|---|---|---|---|
type | string | ไม่ | กรองตามประเภทบัญชี — NATURAL หรือ JURISTIC |
bankCode | string | ไม่ | กรองตามรหัสธนาคาร |
page | number | ไม่ | หมายเลขหน้า (ค่าเริ่มต้น: 1) |
limit | number | ไม่ | จำนวนรายการต่อหน้า (ค่าเริ่มต้น: 20, สูงสุด: 100) |
Type Definitions
typescript
// Response
interface ListBankAccountsResponse {
success: true;
data: {
items: BankAccount[];
total: number;
page: number;
limit: number;
};
}
interface BankAccount {
id: number;
bankCode: string;
bankNumber: string;
nameTh: string;
nameEn: string;
type: 'NATURAL' | 'JURISTIC';
extraVerify: string | null;
createdAt: string; // ISO 8601
updatedAt: string; // ISO 8601
}
// Error Response
interface ErrorResponse {
success: false;
error: {
code: string;
message: string;
};
}ตัวอย่าง
bash
curl -X GET "https://api.easyslip.com/v2/bank-accounts/all?page=1&limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"javascript
const listAllBankAccounts = async (params = {}) => {
const query = new URLSearchParams(params).toString();
const response = await fetch(`https://api.easyslip.com/v2/bank-accounts/all?${query}`, {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const result = await response.json();
if (!result.success) {
throw new Error(result.error.message);
}
return result.data;
};
// การใช้งาน
const { items, total } = await listAllBankAccounts({ limit: 20 });
console.log(`Service มี ${total} บัญชี`);php
function listAllBankAccounts(array $params = []): array
{
$query = http_build_query($params);
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.easyslip.com/v2/bank-accounts/all?' . $query,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY'
]
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if (!$result['success']) {
throw new Exception($result['error']['message']);
}
return $result['data'];
}
// การใช้งาน
$data = listAllBankAccounts(['limit' => 20]);
echo "ทั้งหมด: " . $data['total'];python
import requests
def list_all_bank_accounts(**params) -> dict:
response = requests.get(
'https://api.easyslip.com/v2/bank-accounts/all',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
params=params
)
result = response.json()
if not result['success']:
raise Exception(result['error']['message'])
return result['data']
# การใช้งาน
data = list_all_bank_accounts(limit=20)
print(f"Service มี {data['total']} บัญชี")Response
สำเร็จ (200)
json
{
"success": true,
"data": {
"items": [
{
"id": 12345,
"bankCode": "004",
"bankNumber": "123-4-56789-0",
"nameTh": "บริษัท ตัวอย่าง จำกัด",
"nameEn": "EXAMPLE CO., LTD.",
"type": "JURISTIC",
"extraVerify": null,
"createdAt": "2024-01-15T14:30:00+07:00",
"updatedAt": "2024-01-15T14:30:00+07:00"
}
],
"total": 1,
"page": 1,
"limit": 20
}
}ฟิลด์ใน Response
| ฟิลด์ | ชนิด | คำอธิบาย |
|---|---|---|
items | BankAccount[] | บัญชีทั้งหมดใน Service ของคุณ |
total | number | จำนวนบัญชีที่ตรงเงื่อนไขทั้งหมด |
page | number | หมายเลขหน้าปัจจุบัน |
limit | number | จำนวนรายการต่อหน้า |
Error Responses
Validation Error (400)
json
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "limit: Too big: expected number to be <=100"
}
}หมายเหตุ
- คืน ทุก บัญชีใน Service ของคุณ ไม่ว่าจะเชื่อมโยงกับ Branch ที่เรียกใช้หรือไม่ ต่างจาก
GET /bank-accountsที่คืนเฉพาะบัญชีที่เชื่อมโยงกับ Branch ของคุณ - ภายใน Service เดียวกัน Branch ต่าง ๆ จะเห็นบัญชีของกันและกันตรงนี้ได้ — Branch ภายใน Service เป็นการแบ่งพาร์ทิชัน ไม่ใช่ขอบเขตด้านความปลอดภัย
- บัญชีที่ถูกลบจะไม่รวมอยู่ในผลลัพธ์
limitสูงสุดไม่เกิน100