0
我正在尝试对NodeJS中的批量地理编码执行发布请求。 我正在使用请求库,但由于需要将发布数据作为多行列纯文本数据发送,所以请求失败。诺基亚在这里在NodeJS中的批量地理编码REST请求
采样后的数据(与列分隔符 '|'):
recId|searchText|country
0001|Invalidenstraße 116 10115
这里是我的要求:
requestPromise.post({
uri: 'https://batch.geocoder.cit.api.here.com/6.2/jobs',
qs: {
app_id: {APP ID}
, app_code: {APP CODE}
, action: 'run'
, mailto: {EMAIL}
, gen: 8
, header: true
, ndelim: '%7C'
, outdelim: '%7C'
, outcols: 'displayLatitude,displayLongitude,locationLabel,houseNumber,street,district,city,postalCode,county,state,country'
, outputCombined: false
},
body:'recId|searchText|country\r\n0001|Invalidenstraße 116 10115 Berlin|DEU',
headers: {
'Content-Type':'text/plain',
}
注意这个部分,我尝试使用新行字符(\ r \ n)的:
body:'recId|searchText|country\r\n0001|Invalidenstraße 116 10115 Berlin|DEU'
但我收到此错误信息:
检测到无效的输入标题:[recId | searchText | country]。请修复输入或检查输入分隔符设置。
使用反引号(字符串模板/文字)而不是单引号,删除'\ r \ n'并点击回车键在那个点 –