Unable to execute rest api via curl [closed]

北城以北 提交于 2021-02-17 05:17:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!