问题
I am using Google Geolocation API and trying to run it via curl. But I am unable to do it
Request
{
"considerIp": "true",
"wifiAccessPoints": [{
"macAddress": "00:1e:64:f6:45:aa" // my system mac address
}
]
}
The above request is saved into a file and the file is in the same location where curl is installed.
Curl Request
F:\>curl -d @request.json -H "Content-Type: application/json" -i "https://www.googleapis.com/geolocation/v1/geolocate?key=_Key"
HTTP/1.1 404 Not Found
Vary: X-Origin
Vary: Referer
Content-Type: application/json; charset=UTF-8
Date: Fri, 12 Feb 2021 06:06:38 GMT
Server: scaffolding on HTTPServer2
Cache-Control: private
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3- Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked
{
"error": {
"code": 404,
"message": "Requested entity was not found.",
"errors": [
{
"message": "Requested entity was not found.",
"domain": "global",
"reason": "notFound"
}
],
"status": "NOT_FOUND"
}}
API Settings
I must be missing something that I don't know.
Any help would be highly appreciated.
来源:https://stackoverflow.com/questions/66167163/unable-to-execute-rest-api-via-curl