Curl 和 Git Bast POST 请求
Curl and Git Bast POST request
我正在使用 GIT BASH 在 Curl 中进行 POST 请求。我对这种类型的请求很陌生。我在这里做错了什么?感谢您的建议,这是我第一次尝试这种我不完全理解的请求。这是我正在关注的教程:https://developer.here.com/documentation/batch-geocoder/topics/request-submit.html。
还有其他解决方案吗?
这是我的代码:
Curl 和 GitBast POST 请求
$ curl https://batch.geocoder.cit.api.here.com/6.2/jobs
mailto={simere.com}
&gen=8
&header=true
&indelim=%7C
&outdelim=%7C
&outcols=displayLatitude,displayLongitude,locationLabel,
houseNumber,street,district,city,postalCode,
county,state,country
&outputCombined=false
&app_code={ OBasqavTxfN1}
&app_id={RfsseIcVfmV7w}
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 286 100 286 0 0 295 0 --:--:-- --:--:-- --:--:-- 295{"error":"Bad Request","error_description":"The r equest is missing the app_id and app_code parameters. They must both be passed as query parameters. If you do not have app_id a nd app_code, please obtain them through your customer representative or at http://developer.here.com/myapps."}
renau@DESKTOP-2EC3B6J MINGW64 ~
$ ?action=run
bash: ?action=run: command not found
renau@DESKTOP-2EC3B6J MINGW64 ~
$ mailto={simon.re.com}
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &gen=8
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &header=true
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &indelim=%7C
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &outdelim=%7C
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &outcols=displayLatitude,displayLongitude,locationLabel,
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ houseNumber,street,district,city,postalCode,
bash: houseNumber,street,district,city,postalCode,: command not found
renau@DESKTOP-2EC3B6J MINGW64 ~
$ county,state,country
bash: county,state,country: command not found
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &outputCombined=false
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &app_code={ OBascvTxfN1}
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &app_id={RfsseIQvcVfmV7w}
bash: syntax error near unexpected token `&'
检查页面“Tools”:
When submitting a job using "wget
" and "cURL
", check field names (e.g., &outCols=recId,…
) and field delimiter in the request for both the input and the output.
wget
and cURL
will return a "400 Bad Request
" response in case there is a mistype or when the delimiter does not match the delimiter in the input file.
Both wget
and cURL
need a content type to be specified in the header.
Uploading compressed address data is currently not supported
If you use cURL
, be sure to add the following header
Content-Type: text/plain
and submit the payload using the --data-binary
parameter.
示例:
curl -X POST -H "Content-Type: text/plain" --data-binary @addresses.txt
"https://batch.geocoder.cit.api.here.com
/6.2/jobs?
&app_code={YOUR_APP_CODE}
&app_id={YOUR_APP_ID}
&action=run
&header=true
&inDelim=;
&outDelim=,
&outCols=recId,latitude,longitude,locationLabel
&mailto={YOUR_EMAIL}
&outputcombined=true
&language=de-DE"
我正在使用 GIT BASH 在 Curl 中进行 POST 请求。我对这种类型的请求很陌生。我在这里做错了什么?感谢您的建议,这是我第一次尝试这种我不完全理解的请求。这是我正在关注的教程:https://developer.here.com/documentation/batch-geocoder/topics/request-submit.html。
还有其他解决方案吗?
这是我的代码:
Curl 和 GitBast POST 请求
$ curl https://batch.geocoder.cit.api.here.com/6.2/jobs
mailto={simere.com}
&gen=8
&header=true
&indelim=%7C
&outdelim=%7C
&outcols=displayLatitude,displayLongitude,locationLabel,
houseNumber,street,district,city,postalCode,
county,state,country
&outputCombined=false
&app_code={ OBasqavTxfN1}
&app_id={RfsseIcVfmV7w}
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 286 100 286 0 0 295 0 --:--:-- --:--:-- --:--:-- 295{"error":"Bad Request","error_description":"The r equest is missing the app_id and app_code parameters. They must both be passed as query parameters. If you do not have app_id a nd app_code, please obtain them through your customer representative or at http://developer.here.com/myapps."}
renau@DESKTOP-2EC3B6J MINGW64 ~
$ ?action=run
bash: ?action=run: command not found
renau@DESKTOP-2EC3B6J MINGW64 ~
$ mailto={simon.re.com}
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &gen=8
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &header=true
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &indelim=%7C
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &outdelim=%7C
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &outcols=displayLatitude,displayLongitude,locationLabel,
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ houseNumber,street,district,city,postalCode,
bash: houseNumber,street,district,city,postalCode,: command not found
renau@DESKTOP-2EC3B6J MINGW64 ~
$ county,state,country
bash: county,state,country: command not found
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &outputCombined=false
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &app_code={ OBascvTxfN1}
bash: syntax error near unexpected token `&'
renau@DESKTOP-2EC3B6J MINGW64 ~
$ &app_id={RfsseIQvcVfmV7w}
bash: syntax error near unexpected token `&'
检查页面“Tools”:
When submitting a job using "
wget
" and "cURL
", check field names (e.g.,&outCols=recId,…
) and field delimiter in the request for both the input and the output.
wget
andcURL
will return a "400 Bad Request
" response in case there is a mistype or when the delimiter does not match the delimiter in the input file.
Bothwget
andcURL
need a content type to be specified in the header.
Uploading compressed address data is currently not supportedIf you use
cURL
, be sure to add the following headerContent-Type: text/plain
and submit the payload using the
--data-binary
parameter.
示例:
curl -X POST -H "Content-Type: text/plain" --data-binary @addresses.txt
"https://batch.geocoder.cit.api.here.com
/6.2/jobs?
&app_code={YOUR_APP_CODE}
&app_id={YOUR_APP_ID}
&action=run
&header=true
&inDelim=;
&outDelim=,
&outCols=recId,latitude,longitude,locationLabel
&mailto={YOUR_EMAIL}
&outputcombined=true
&language=de-DE"