Vision 6

getBatchIdByQueueId

Returns the Batch ID for a Batch queue ID.

getBatchIdByQueueId

Returns the Batch ID for a Batch queue ID.

Top ↑

Syntax

int getBatchIdByQueueId( string api_key, int queue_id );

Parameters

api_key (string)

The key required to access the API. See Getting Started for more information.

queue_id (int)

The Batch queue ID returned by addBatch or addBatchByContactSearch.

Return Value

Returns the Batch Id when the population of the Batch is complete. Returns 0 if Batch is still being populated with Contacts.

Examples

PHP

$api = new Api($url, 'YOURAPIKEY');

$queue_id = 1234567;

// get batch_id (returns 0 if batch population has not completed)
$batch_id = 0;
while ($batch_id == 0) {
    sleep(5); // wait 5 seconds before polling again
    $batch_id = $api->invokeMethod('getBatchIdByQueueId', $queue_id);
}

print "The batch ID is ". $batch_id ."\n";

JSON Request

{
    "id": 1,
    "method": "getBatchIdByQueueId",
    "params": [
        "YOURAPIKEY",
        1234567
    ]
}

JSON Response

{
    "id": 1,
    "result": 1857902,
    "error": null
}

Remarks

Poll this method periodically after calling addBatch or addBatchByContactSearch to retrieve the Batch ID once the Batch has been created.

Error Codes

This method may return the following error code in addition to the standard error codes:

Code Error Description
302 Undefined Error queue_id record was not found.

See Also