ผู้ติดต่อ: ฟิลด์กำหนดเอง

แสดงรายการฟิลด์

ฟิลด์กำหนดเองทุกฟิลด์ของบัญชี พร้อมชนิดและตัวเลือก เรียงตามคีย์

POSThttps://g.sendcorex.com/v1/contactscommand: list_fields

ต้องมีขอบเขต contact:read บน API key ของคุณ

อาร์กิวเมนต์

endpoint นี้ไม่มีอาร์กิวเมนต์

เริ่มต้นอย่างรวดเร็ว

import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/contacts',
  {
    commands: [
      {
        command: "list_fields"
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);

การตอบกลับ

{
  "type": "SUCCESS",
  "results": [
    {
      "command": "list_fields",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 14,
      "data": {
        "fields": [
          {
            "key": "age",
            "name": "Age",
            "type": "number",
            "options": null,
            "created_at": "2026-10-01T10:00:00.000Z",
            "updated_at": "2026-10-01T10:00:00.000Z"
          },
          {
            "key": "plan",
            "name": "Plan",
            "type": "enum",
            "options": [
              "free",
              "pro",
              "business"
            ],
            "created_at": "2026-10-01T10:00:00.000Z",
            "updated_at": "2026-10-01T10:00:00.000Z"
          }
        ],
        "limit": 100
      }
    }
  ]
}

ฟิลด์การตอบกลับ

  • fields[].key

    คีย์ที่ใช้ใน fields, ใน where และใน sort (fields.<key>)

  • fields[].name

    ชื่อที่แสดง

  • fields[].type

    text, number, date, bool, enum หรือ multi_enum

  • fields[].options

    ค่าที่อนุญาตของฟิลด์ enum และ multi_enum

  • limit

    จำนวนฟิลด์ที่บัญชีมีได้ (100)

ข้อผิดพลาด

ข้อผิดพลาดระดับ HTTP ส่งกลับ type, code และ message ข้อผิดพลาดที่มีเครื่องหมาย CMD จะกลับมาในผลลัพธ์ของคำสั่ง พร้อม HTTP 200

  • 401INVALID_API_KEY

    API key ไม่มีอยู่ ถูกเพิกถอน หรือถูกปิดในแดชบอร์ด

  • 429RATE_LIMITED

    เกิน 15 คำขอ/วินาที หรือ 15 คำขอพร้อมกันสำหรับ IP + API key เดียวกัน รอจำนวนวินาทีใน Retry-After

  • CMDMISSING_SCOPE

    API key ไม่มีขอบเขตที่คำสั่งนี้ต้องการ คำสั่งอื่นในคำขอยังทำงาน

  • CMDINTERNAL

    ข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์