HERE API 从不运行批处理作业,总是 returns 接受状态
HERE API never runs batch job, always returns accepted status
由于某种原因,我的应用程序今天早上停止工作。提交工作后,在请求其状态时,它只会 returns accepted
这是我用来创建和 运行 作业的代码:
$url = "https://batch.geocoder.api.here.com/6.2/jobs?action=run&app_code=".$app_code."&app_id=".$app_id."&mailto=Whosebug@example.com&outcols=latitude,longitude,locationLabel&outputcombined=true&indelim=|&outdelim=|&language=hu-HU&header=true";
if($cURLHandler) {
curl_setopt($cURLHandler, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
curl_setopt($cURLHandler, CURLOPT_BINARYTRANSFER, true);
curl_setopt($cURLHandler, CURLOPT_POST, true);
curl_setopt($cURLHandler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURLHandler, CURLOPT_POSTFIELDS, file_get_contents($userFolderURL."/batchjob.txt"));
curl_setopt($cURLHandler, CURLOPT_URL, $url);
$cURLResults = curl_exec($cURLHandler);
curl_close($cURLHandler);
}
这是例子的内容batchjob.txt:
recId|searchText|country
1|"2120 Dunakeszi Barátság útja 18"|HUN
2|"2120 Dunakeszi Barátság útja 18"|HUN
3|"2120 Dunakeszi Baràtsàg útja 12"|HUN
4|"2120 Dunakeszi Barátság utja 49"|HUN
5|"2120 Dunakeszi Barátság útja 3"|HUN
6|"2120 Dunakeszi Barátság útja.30"|HUN
7|"2120 Dunakeszi Bátorkeszi utca 7."|HUN
8|"2120 Dunakeszi bercsényi u 27"|HUN
9|"2120 Dunakeszi Déli utca 12."|HUN
创建并 运行 作业后,我使用以下 cURL 请求每 10 秒检查一次它的状态:
$url = "https://batch.geocoder.api.here.com/6.2/jobs/".$requestID."?action=status&app_code=".$app_code."&app_id=".$app_id;
$ch = curl_init();
if($ch) {
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
}
但它总是returns以下xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1"><Response><MetaInfo><RequestId>REQUESTID ommited</RequestId></MetaInfo><Status>accepted</Status><TotalCount>0</TotalCount><ValidCount>0</ValidCount><InvalidCount>0</InvalidCount><ProcessedCount>0</ProcessedCount><PendingCount>0</PendingCount><SuccessCount>0</SuccessCount><ErrorCount>0</ErrorCount></Response></ns2:SearchBatch>
我仔细检查过,我的应用程序代码和应用程序 ID 都是有效的,所以我真的不明白为什么会发生这种情况。
根据 official docs,我的第一个 cURL 请求应该创建并启动该作业,但是出于某种原因它似乎从未执行过?这可能是什么问题?
状态"accepted" 表示您的作业已排队,正在等待槽执行。我们 HERE 正在监控队列,以确保根据需要调整容量。
所以我猜你的应用没问题,瓶颈可能在我们这边。
由于某种原因,我的应用程序今天早上停止工作。提交工作后,在请求其状态时,它只会 returns accepted
这是我用来创建和 运行 作业的代码:
$url = "https://batch.geocoder.api.here.com/6.2/jobs?action=run&app_code=".$app_code."&app_id=".$app_id."&mailto=Whosebug@example.com&outcols=latitude,longitude,locationLabel&outputcombined=true&indelim=|&outdelim=|&language=hu-HU&header=true";
if($cURLHandler) {
curl_setopt($cURLHandler, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
curl_setopt($cURLHandler, CURLOPT_BINARYTRANSFER, true);
curl_setopt($cURLHandler, CURLOPT_POST, true);
curl_setopt($cURLHandler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURLHandler, CURLOPT_POSTFIELDS, file_get_contents($userFolderURL."/batchjob.txt"));
curl_setopt($cURLHandler, CURLOPT_URL, $url);
$cURLResults = curl_exec($cURLHandler);
curl_close($cURLHandler);
}
这是例子的内容batchjob.txt:
recId|searchText|country
1|"2120 Dunakeszi Barátság útja 18"|HUN
2|"2120 Dunakeszi Barátság útja 18"|HUN
3|"2120 Dunakeszi Baràtsàg útja 12"|HUN
4|"2120 Dunakeszi Barátság utja 49"|HUN
5|"2120 Dunakeszi Barátság útja 3"|HUN
6|"2120 Dunakeszi Barátság útja.30"|HUN
7|"2120 Dunakeszi Bátorkeszi utca 7."|HUN
8|"2120 Dunakeszi bercsényi u 27"|HUN
9|"2120 Dunakeszi Déli utca 12."|HUN
创建并 运行 作业后,我使用以下 cURL 请求每 10 秒检查一次它的状态:
$url = "https://batch.geocoder.api.here.com/6.2/jobs/".$requestID."?action=status&app_code=".$app_code."&app_id=".$app_id;
$ch = curl_init();
if($ch) {
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
}
但它总是returns以下xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1"><Response><MetaInfo><RequestId>REQUESTID ommited</RequestId></MetaInfo><Status>accepted</Status><TotalCount>0</TotalCount><ValidCount>0</ValidCount><InvalidCount>0</InvalidCount><ProcessedCount>0</ProcessedCount><PendingCount>0</PendingCount><SuccessCount>0</SuccessCount><ErrorCount>0</ErrorCount></Response></ns2:SearchBatch>
我仔细检查过,我的应用程序代码和应用程序 ID 都是有效的,所以我真的不明白为什么会发生这种情况。
根据 official docs,我的第一个 cURL 请求应该创建并启动该作业,但是出于某种原因它似乎从未执行过?这可能是什么问题?
状态"accepted" 表示您的作业已排队,正在等待槽执行。我们 HERE 正在监控队列,以确保根据需要调整容量。
所以我猜你的应用没问题,瓶颈可能在我们这边。