POST request sent to /sharing/rest/ redirects to /sharing/

371
1
Jump to solution
02-01-2024 11:19 AM
Labels (2)
bnkpollen
New Contributor

Hello, I am trying to make an API call to the below endpoint

https://myarcgisserver.mycompany.com/portal/sharing/rest/content/users/myadminuser/createService

 When I call this endpoint, I get the below error in an html response

Did you mean /sharing/rest/...?

  You are using an unsupported version of this API located at /sharing/. Avoid using and/or developing with this unsupported version. There are pitfalls in doing so and no advantages over using the released and supported version of the API, which is logically equivalent. The supported version is located at /sharing/rest/.

 I am seeing the below 2 lines after making this call in the log file on the Enterprise server at C:\inetpub\logs\LogFiles\W3SVC1 

2024-01-31 22:45:12 10.0.0.8 POST /portal/sharing/rest/content/users/myadminuser/createService - 443 - 10.0.0.1 python-requests/2.31.0 - 302 0 0 4010

2024-01-31 22:45:12 10.0.0.8 GET /portal/sharing/content/users/myadminuser - 443 - 10.0.0.1 python-requests/2.31.0 - 200 0 0 434

 So, it appears the POST method is redirecting (per the 302 HTTP status), but using the /sharing/ path instead of the /sharing/rest path.

Any ideas what would cause this? I have reproduced the issue using PostMan also. 

0 Kudos
1 Solution

Accepted Solutions
bnkpollen
New Contributor

The issue here was that I was not using the createParameters correctly in the request and I was also not including the f: json parameter. I did not realize that the createParameters is a json object that is included as part of the request parameters, rather than separate parameters for each field in the request. I suspect that the service then created a "null" service and redirected to the parent with HTML response. 

View solution in original post

0 Kudos
1 Reply
bnkpollen
New Contributor

The issue here was that I was not using the createParameters correctly in the request and I was also not including the f: json parameter. I did not realize that the createParameters is a json object that is included as part of the request parameters, rather than separate parameters for each field in the request. I suspect that the service then created a "null" service and redirected to the parent with HTML response. 

0 Kudos