Does ArcGIS Earth do any sort of realtime logging to track down a 405 PUT error.

1886
7
Jump to solution
03-22-2021 09:33 AM
BillSmith
New Contributor III

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

1 Solution

Accepted Solutions
Willy
by
New Contributor II

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 

Willy_0-1616466540129.png

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",  

Willy_2-1616467846836.png

 

 

 

View solution in original post

7 Replies
Willy
by
New Contributor II

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 

Willy_0-1616466540129.png

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",  

Willy_2-1616467846836.png

 

 

 

BillSmith
New Contributor III

Thank you.  It seems that I was doing a post when I needed to use curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);

0 Kudos
ben_tan
New Contributor II

Hi BillSmith. Thanks for the feedback and so detailed information.

  • ArcGIS Earth automation API does not output real-time logs for this version. We will consider it in the future. At this moment, you can get more information from the help page: http://localhost:8000/swagger/index.html
  • The request of `Camera` only allows `GET` and `PUT` methods for this version, and it might return 405 if we use other methods.  Here, we need to use the `PUT` method. I have tried your request with the postman. It looks good.

Thanks!

BillSmith
New Contributor III

Thanks Ben.  I was doing a POST with libcurl instead of a PUT.  So strict.

0 Kudos
BillSmith
New Contributor III

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.

0 Kudos
ben_tan
New Contributor II

Hi BillSmith, thanks for the suggestion.

  • We considered this issue from the interface design level at the time.  Usually, POST is used to create a resource, and PUT is used to create a resource or overwrite an existing resource. In ArcGIS Earth, the camera is considered a unique resource. So PUT is used to change the camera under these considerations.  ( We might decide to use POST camera for multi-view cases in the future) 
  • For other situations, The ArcGIS Earth Automation API will also prefer to use POST. For example, we can use the POST method to add a layer or a graphic. 

All the best!

BillSmith
New Contributor III

Thank you for the information Ben!

Best Regards,

-Bill

0 Kudos