Hello, I'm trying to track down a 405 error while using libcurl/C++ to do a post request to the ArcGIS Earth automation api. I'm wondering if there is any real time logging done by AGEarth. The only logging I see hasn't been written to since I installed AGEarth last month which is here:
C:\Users\user.name\AppData\Roaming\Esri\ArcGISEarth\logs\ArcGISEarth1.11.log
BTW: I am able to do get request without incident. Whenever I try to post anything I get the dreaded 405 error.
ie. request is http://localhost:8000/arcgisearth/camera
body is {"position":{"x":69.199685, "y":34.547899, "z":5779.406081}, "spatialReference": {"wkid": 4326}},"heading":0.017549, "tilt":0.000000,"roll":0.000000}
header is: "Content-Type:application/json"
Return code of 405:
httpPost(): Bad http return code: 405 returned from httpPost request, result header: HTTP/1.1 405 Method Not Allowed
Date: Mon, 22 Mar 2021 15:44:14 GMT
Content-Type: text/plain
Server: Kestrel
Transfer-Encoding: chunked
Allow: GET, PUT
Solved! Go to Solution.
Hi BillSmith,
The HTTP method for setting the camera is "PUT".
In the Automation API user guides, the HTTP method is also specified at the end of the request URL, like
After Earth launching, you can also try the Earth automation API samples via this URL in your web browser "http://localhost:8000/sample/index.html",
Hi BillSmith,
The HTTP method for setting the camera is "PUT".
In the Automation API user guides, the HTTP method is also specified at the end of the request URL, like
After Earth launching, you can also try the Earth automation API samples via this URL in your web browser "http://localhost:8000/sample/index.html",
Thank you. It seems that I was doing a post when I needed to use curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
Hi BillSmith. Thanks for the feedback and so detailed information.
Thanks!
Thanks Ben. I was doing a POST with libcurl instead of a PUT. So strict.
One more suggestion. Why only GET and PUT? Is ESRI too good for POST?
We use that for 99% of our code. I'm still working on getting libcurl PUT to succeed.
Hi BillSmith, thanks for the suggestion.
All the best!
Thank you for the information Ben!
Best Regards,
-Bill