I am looking to query static table data from my portal at the start of my application. I don't want to add the data to my map, just get the information from this table to store in memory. I know how to add these tables to my map, but I really just want to use them as an api for information. I almost want to simply use them as a webapi of sorts to query information from them when i need it. I want to hide these table from our users. I am thinking i need to somehow query against them using my portal credentials and a properly formated URL. But can seem to get it right. In catalog here is what my tables and layers that I want to query against look like. Could someone point me in the right direction?
Hi MKa,
I assume these portal tables are part of a feature service, right?
Start by creating a connection to the feature service, and then creating a Geodatabase from that connection. You can accomplish this by creating a ServiceConnectionProperties object, and then using the Geodatabase(ServiceConnectionProperties) constructor.
Once you have a Geodatabase, you can open tables and query using OpenDataset and Search.
I hope this helps,
--Rich
Calling OpenDataset does not download the contents of the table- just some metadata about the table definition. The only data that is downloaded are the rows specified by the QueryFilter in Table.Search.
--Rich
It's always possible to access Esri REST services such as the feature service outside of the Pro SDK. I'm not familiar with the benefits of that solution, although the integration with Pro would obviously be harder.
Rich,
I am not trying to do a simple EsriHttpClient query after I verify that my Portal is up and I am signed in. I have tried every variation of the query using the EsriHttpCient and I cannot get the query to work. Has anyone else ever run into this or tried to return results in code? I keep getting the 400 error
"{\"error\":{\"code\":400,\"message\":\"Unable to complete operation.\",\"details\":[\"Unable to perform query operation.\"]}}".
Here is my latest. I have tried breaking this up in everyway and this works in postman with a token, but in my code I don't need the token because I am using the EsriHttpClient
EsriHttpClient client = new EsriHttpClient();
string path = "https://MYServer/arcgis/sharing/servers/59621f9802e04755b9a872c25fcfb7ef/rest/services/MyWebService/...";
string query = string.Format("query?{0}&f=json&outFields=*&returnGeometry=true&returnIdsOnly=false", "where=PlantCode='ABC1' and Code='010'");
EsriHttpResponseMessage searchResponse = client.Get(path + query);
HttpContent content = searchResponse.Content;
string response = await content.ReadAsStringAsync();
dynamic resultItems = JObject.Parse(response);
I have been using fiddler and it looks like the EsriHttpClient is doing something to my above where clause
THIS code from above
string query = string.Format("query?{0}&f=json&outFields=*&returnGeometry=true&returnIdsOnly=false", "where=PlantCode='ABC1' and Code='010'");
EsriHttpResponseMessage searchResponse = client.Get(path + query);
HttpContent content = searchResponse.Content;
Should send this URI
"query?where=PlantCode='ABC1' and Code='010'&f=json&outFields=*&returnGeometry=true&returnIdsOnly=false"
But instead, fiddler shows this going through
"query?where=PlantCode&f=json&outFields=*&returnGeometry=true&returnIdsOnly=false"
Notice how after the PlantCode the equals sign is cuttoff? How do i tell the EsriHttpRequest to ignore that and not do that. This works in Postman, so I know it has to be possible.