หน้าแรก เอกสาร บทช่วยสอน ลงชื่อเข้าใช้
ประเภทงานที่รองรับ
เมธอด API
บทความ
บทช่วยสอน
GitHub
เมนูเอกสาร

pushAntiGateVariable: ส่งค่าตัวแปรสำหรับงาน AntiGate

งาน AntiGate มีฟีเจอร์: ค่าตัวแปรสามารถส่งได้ภายหลังหลังจากสร้างงาน โดยทำตามขั้นตอนต่อไปนี้

  1. เพิ่มขั้นตอน "WAIT_FOR_VARIABLE_VALUE" ไปยังเทมเพลตของคุณและระบุชื่อตัวแปรเป็นค่าถาวร
  2. เนื่องจากค่าตัวแปรทั้งหมดควรถูกส่งไปยังเมธอด createTask ให้แทนที่ค่าตัวแปรด้วยสตริง "_WAIT_FOR_IT_"

หากคำขอสร้างงานของคุณอาจมีลักษณะดังนี้:

CURL
          curl -i -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -X POST -d '{
    "clientKey":"YOUR_API_KEY",
    "task":
        {
            "type":"AntiGateTask",
            "websiteURL":"https://some-website.com/path",
            "templateName":"Template name here",
            "variables": {
                "my_late_variable":"_WAIT_FOR_IT_",
                "other_var1":"some value",
                "other_var2":"some value"
            }
        }
}' https://api.anti-captcha.com/createTask
        

จากนั้นคำขออัปเดตตัวแปร "my_late_variable" ควรมีลักษณะดังนี้:

CURL
          curl -i -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -X POST -d '{
    "clientKey":"YOUR_API_KEY",
    "taskId":123456,
    "name":"my_late_variable",
    "value":"The value which worker should be waiting for"
}' https://api.anti-captcha.com/pushAntiGateVariable
        

ที่อยู่: https://api.anti-captcha.com/pushAntiGateVariable
เมธอด: POST
Content-type: application-json

คุณสมบัติคำขอ

คุณสมบัติ ประเภท จำเป็น วัตถุประสงค์
clientKey สตริง ใช่
taskId จำนวนเต็ม ใช่
name สตริง ใช่ ชื่อของตัวแปร
value ทั้งหมด ใช่ ค่าของตัวแปรที่ถูกเลื่อน

โครงสร้างการตอบกลับ

คุณสมบัติ ประเภท วัตถุประสงค์
errorId จำนวนเต็ม ตัวระบุข้อผิดพลาด
0 - ไม่มีข้อผิดพลาด การดำเนินการเสร็จสมบูรณ์
>1 - ตัวระบุข้อผิดพลาด รหัสข้อผิดพลาดและคำอธิบายสั้นๆ อยู่ในคุณสมบัติ errorCode และ errorDescription
errorCode สตริง
errorDescription สตริง คำอธิบายสั้นๆ เกี่ยวกับข้อผิดพลาด

ตัวอย่างการตอบกลับ

JSON ที่ไม่มีข้อผิดพลาด
          {
    "errorId":0,
    "status":"success"
}
        
JSON ที่มีข้อผิดพลาด
          {
    "errorId": 1,
    "errorCode": "ERROR_KEY_DOES_NOT_EXIST",
    "errorDescription": "Account authorization key not found in the system"
}