# Predictive Outbound - Create a pre-test outbound task interface

#### Interface Description

Create a pre-test outbound task. Note: The number of numbers for a single task should not exceed 10,000. If you need to add more numbers, please submit through the additional interface。

#### request parameters

| parameter name | type | Is it necessary | illustrate |
| --- | --- | --- | --- |
| service | string | yes | App.Sip\_Yccall.TaskCreat |
| token | string | yes | Obtain token through interface authorization |
| assigntype | int | yes | Allocation Type 1: Extension; 2: Queue; 3: Group |
| assignagent | string | yes | Set as an extension, fill in the extension directly; set as a queue, fill in the queue name; set as a group, fill in the group name |
| telphone | string（JSON） | yes | 
Mobile phone number, preset call time (time stamp) (the current time stamp is the default, if the time is greater than this time, no call will be made), etc. example：\[{“phone”:18012345678,”time”:1500000000,”userid”:””,”memberid”:””,”chengshudu”:””,”customuuid”:””}\] |
| taskscale | string | yes | Idle agent call ratio Format 1:1 |
| disnumber | string | yes | Calling number, multiple numbers separated by commas (empty means random) |
| taskname | string | no | task name |

#### Interface request example（PHP）

    <?php
        $apiUrl = 'http://127.0.0.1:8080';
        foreach ($phoneArr as $phone){
            $telphoneArr[] = [
                'phone' => trim($phone),
                'time'  => $start_time,
                'memberid'  => '',
                'chengshudu'  => '',
                'customuuid'  => '',
                ];
        }
        $postFields = [
            'service'   => 'App.Sip_Yccall.TaskCreat',
            'token'     => 'ABCDEFG',
            'assigntype'    => 2,
            'assignagent'   => 'queue-1',
            'telphone'      => json_encode($telphoneArr),
            'taskscale'     => '1:1',
            'disnumber'     => ''
        ];
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $apiUrl);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        $response = curl_exec($curl);
        $curlError = curl_error($curl);
        curl_close($curl);
        var_dump($response);
    ?>
    

#### return data structure example

    {
        "ret": 200,
        "data": {
            "status": 0,
            "desc": "created successfully",
            "result": {
                "taskid": "20200212163504393460",
                "invaliddata": []
            },
            "reqtime": 1581496504,
            "rsptime": 1581496504
        },
        "msg": ""
    }
    

#### Return parameter description

| parameter name | type | illustrate |
| --- | --- | --- |
| result | object | return result |
| taskid | string | task unique id |
| invaliddata | array | invalid data |