Select to view content in your preferred language

Accessing the private services in service directory ArcGISPortal

945
6
09-03-2013 09:38 PM
HumzaAkhtar
Deactivated User
Hi Everyone,

I want to know that when I access the services directory of ARCGIS online of my organization, I get in response only those services which are public. I want to access the services directory which will show me the services which are private as well. Is it possible? The method I am using right now is that I use IdentityManager to get the credentials of the user and then I use the credentials to GetItemsAsync() in order to get the items of the user public or private. But when I trim the url of the item to get to the Home directory of service and when I send the home directory of the services to json I get in response only the public services.

Thanks and Regards
0 Kudos
6 Replies
AnttiKajanus1
Deactivated User
Can you tell me how do you trim the url and how do you access to the home level of the service? I haven't tested similar case but it should work if you keep the token defined in every request.

If you access to layers (webmap) via Document, remember to set Token property.
If you are accessing to layer via Layer (ie. dynamic), make sure that Token gets set.
If you are accessing via custom http call using ArcGISWebClient it doesn't automatically activate IdentityManger so it should be activated before using it.
If you are accessing to layer via custom http call, remember to keep ?token=<token> defined.

But if you tell how you access to the home level of the service, maybe I can give better pointers.
0 Kudos
HumzaAkhtar
Deactivated User
Can you tell me how do you trim the url and how do you access to the home level of the service? I haven't tested similar case but it should work if you keep the token defined in every request.

If you access to layers (webmap) via Document, remember to set Token property.
If you are accessing to layer via Layer (ie. dynamic), make sure that Token gets set.
If you are accessing via custom http call using ArcGISWebClient it doesn't automatically activate IdentityManger so it should be activated before using it.
If you are accessing to layer via custom http call, remember to keep ?token=<token> defined.

But if you tell how you access to the home level of the service, maybe I can give better pointers.


Hi,

thanks a lot for your reply. I really appreciate that 🙂

What I am doing is something like this

1. I present a dialog box in which I get user id and password for ArcGIS online
2. I use GetItemsAsync() function to get all the portal items Urls, secure and non secure both under that user's name.
3. I send one Url out of many to another function which removes the last two parts of the Url so that the Url ends with only '/services' e.g  http://xxxxx/arcgis/rest/services/US_Map/FeatureService to http://xxxxx/arcgis/rest/services
4. I perform JSON query on the resulting Url and create a tree like view in XAML. with the names and the URLs of the service. Then If a user clicks on one of the names. It creates a layer using the URL and then projects the layer on to the map.

However when I perform Json query on the services Url aka http://xxxxx/arcgis/rest/services I only get the public services in response. I donot know how to incorporate token into the services home directory url so that I can see the private services as well.

I will be grateful if you can shed some light on it.
0 Kudos
HumzaAkhtar
Deactivated User
Now I am generating a token for the FeatureService in my ArcGIS online services and using the same token to access the Feature Layers in my FeatureService but I am having invalid token error. Do youknow that the token for feature layers is different from the parent featureservice (one which ends with '/FeatureServer') or not?
0 Kudos
AnttiKajanus1
Deactivated User
I think it should be the same Token.

I try to have time today to test this out. How do you query the root level? I suppose that is a custom REST call?
0 Kudos
HumzaAkhtar
Deactivated User
I think it should be the same Token.

I try to have time today to test this out. How do you query the root level? I suppose that is a custom REST call?


Yes it is a custom Json query which returns with the list of services and their urls.
0 Kudos
AnttiKajanus1
Deactivated User
Hi,

I can get my private services from http://resources.arcgis.com/en/help/rest/apiref/catalog.html

H
ere is my test code:

IdentityManager.Current.GenerateCredentialAsync(
                "http://www.arcgis.com/sharing/rest/",
                "", // here should be your username 
                "",    // here should be your password 
                (credential, ex) =>
                {
                    if (ex != null)
                    {
                        MessageBox.Show(ex.ToString());
                        return;
                    }


                    var webClient = new ArcGISWebClient();


                    var parameters = new Dictionary<string, string>
                                 {
                                     { "f", "json" },
                                     { "token", credential.Token}
                                 };




                    webClient.DownloadStringCompleted += (sender, args) =>
                        {
                            MessageBox.Show(args.Result.ToString());
                        };
                    webClient.DownloadStringAsync(new Uri("http://services.arcgis.com/AddYourIdentity/ArcGIS/rest/services"), parameters);
                });


If you share your request and code, I might be track it down.
0 Kudos