Thanks Ken,
i have hosted your function on my Azure portal and tested on inReach portal and test successful. i have replaced with my own feature service with same structure of fields, but i am getting below error, any idea ?
Hi Surenderreddy Konatham,
This may happen if your Azure function's Authorization level is set to Function or Admin which would require inReach Portal Connect to send authentication credentials with each request. If this is required it may be possible for you to implement that but I do not know what would be required to do so.
Switch auth level to Anonymous by going to Integrate settings in your Azure function:
then set Authorization level to Anonymous:
and click save.
Also, I found and corrected an error in my code so please update your function. While verifying this behavior this morning I noticed I had left off a rather important element to the feature json that gets sent to the feature layer - spatialReference (DOH!!!). InReach sends data in WGS84 (wkid 4326) while ArcGIS Online feature layers use, by default, web mercator (wkid 102100). If incoming features include spatialReference info other than web merc, the feature layer will project them correctly to web merc and store them. Otherwise it assumes the features are already in web merc and does nothing to the geometries resulting in incorrect placement for inReach features.
I have updated my code on GitHub.
Ken
Hi Ken,
I got your latest code updates from GitHub.
I tried using both the Authorization level options (Anonymous and Function), but no luck, Please refer below snapshot. but i got success with your feature service, is there any security configurations or any other settings i need to look on my feature service?
The example on the right makes perfect sense. You get a 401 (Unauthorized) error because the Azure function has an authorization level of 'Function' meaning it restricts requesting clients to only those sending proper credentials. inReach Portal sends no such credentials so the request fails. This is why you must set the function's Auth level to 'Anonymous'.
Regarding the left example, is your feature layer shared with everyone? The code I shared assumes an unprotected destination feature layer. Thus it does not send a token or any other kind of credentials. This is entirely possible to enable. To do so follow guides and examples for our .Net developer API. That being said, I suspect the issue is something else given the error returned. When I unshared my feature layer and attempted to send a test message from Portal Connect, the error returned was a 400 (Bad request).
Can you confirm the destination feature layer is of the correct schema? If not you can create a new one in your portal by using mine as a template.
Can you share the url to your feature layer? If you are reluctant to post it in this public forum thread but are willing and able to share your feature layer with me you may email me directly at kgorton@esri.com. I will be happy to have a look.
Ken,
I got success with my new feature service, thank you so much.
I really appreciate your support on this issue.
Suren
This is exactly what I am trying to implement but I cant seem to get Visual Studio to work with me. Would you be willing to help out?
Hi JohnMiele,
I must admit I had to dig out the solution code and refresh my memory of this, but yes, I am happy to help if I may. Are you attempting to use Visual Studio (VS) or Visual Studio Code (VSCode). I implemented this using VSCode but it should also be possible in VS.
Ken
Hi Ken,
I am using Visual Studio Code but cant seem to figure it out. I'm not skilled in programing and cant sort out how to get your code to work. Any help would be greatly appreciated! We are starting a 250 relay hike to follow Boone Trace through Virginia and Kentucky and I need to get this figured out asap. We plan to use this for other hikes later on as well. www.BooneTrace250.com
Hi JohnMiele,
I sent you a private message with a potential solution that may work only for your case (thus I didn't want to put it here). Let me know if you didn't receive it. Please reply to the private message with any additional questions about that particular approach and let me know your thoughts.
Ken