For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
5 0 1 2

What is the difference between UsersContext and AuthenticationContext?

In Dss.Api.Examples.Authentication.AuthorizationExamples both are used to get session token. Are there any recommendations when to use which?

dssauthenticationdss-soap-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
32.2k 41 11 20

Hello @ihor.fedoryshyn ,

If you require to authenticate, both AuthenticationContext and UsersContext work, and you can:

var authenticationContext = ContextHelper.CreateAuthenticationContext(false);
            Status.Notify(authenticationContext, null, "RequestToken", MethodType.Operation, Publish.Secondary
            var sessionToken = authenticationContext.SessionToken;

UsersContext additionally it includes User preferences handling capabilities:

   [GeneratedCode("Microsoft.OData.Client.Design.T4", "1.0.0")]
        public IDssQueryable<UserClaim> UserClaims { get; }
        [GeneratedCode("Microsoft.OData.Client.Design.T4", "1.0.0")]
        public IDssQueryable<UserPreference> UserPreferences { get; }
        [GeneratedCode("Microsoft.OData.Client.Design.T4", "1.0.0")]
        public IDssQueryable<User> Users { get; }
        public IUserClaimOperations UserClaimOperations { get; }
        public IUserClaimOperationsAsync UserClaimOperationsAsync { get; }
        public IUserPreferenceOperations UserPreferenceOperations { get; }
        public IUserPreferenceOperationsAsync UserPreferenceOperationsAsync { get; }
        public IUserOperations UserOperations { get; }
        public IUserOperationsAsync UserOperationsAsync { get; }

For example:

var UsersContext = new UsersContext(new Uri("https://selectapi.datascope.refinitiv.com/RestApi/v1/"), "<your user id>", "<your password>");

//Fetch the user preferences
var userPreferences = UsersContext.UserPreferenceOperations.GetAll().First();

//Make changes
userPreferences.ContentSettings.PartialEmbargoedReportsEnabled = false;
UsersContext.UserPreferenceOperations.Update(userPreferences);

For illustrative examples of usage, see Refinitiv DSS C# Example Application -> section "User Examples",

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.